Hello,
Thank you for contacting Rank Math today.
Instead of having to resave all posts and assign the noindex tag, you can add the following code snippet on your theme’s functions.php file:
/**
* Allows filtering of the robots meta data.
*
* @param array $robots The meta robots directives.
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
if(is_singular('posts')){
$robots['index'] = "noindex";
$robots['follow'] = "nofollow";
return $robots;
}
return $robots;
});
Looking forward to helping you. Thank you.
Thank you for the snippet. I have added it. It still shows “search exclude – visible” in the post list.
Hi, update: I have just noticed that in the rank math side window of the posts it does say “NOINDEX ROBOTS META IS ENABLED”. I assume that is more relevant and the post will not be indexed through google. Please confirm. Thanks
Hello,
Thank you for contacting Rank Math today.
Yes, “NOINDEX ROBOTS META IS ENABLED”
means the post/page won’t be indexed by search engines.
Looking forward to helping you. Thank you.
Is there an easy way to stop indexing the whole site? I have a staging site for development and testing purposes and I do not want that site to be indexed. Inserting the snippet in functions.php is doable but time consuming. Is there a simple checkbox or similar that I can use every time I copy my production site to staging in a multisite envoronment?
Hello,
Meanwhile Rank Math doesn’t have that feature (unless you use the code my colleague said), you could use the default option in WordPress, just as I show you in the following screencast: https://i.rankmath.com/2mwdtb
Looking forward to help you.
Thanks for your answer Alberto! Appreciate Rank Math’s support.
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.