Hello,
Thank you for contacting Rank Math.
We sorry but that option is not available in Rank Math. You can noindex the category itself but not the posts inside. You will have to do it manually. You can also noindex all posts in one go but not posts belonging to a particular category.
With that being said, there are existing feature requests, so we’ve added your vote to our internal suggestions lists. If your suggestions are something that we’re able to introduce, we’ll be sure to let you know.
Hope that helps.
Hm – thats not good. Cant we do anything via functions.php to archive this? I noted that many many people do have the same need.
Hello,
Please use the code given below. This code will mark all the posts in a category as noindex and the posts will not be included in the sitemap
add_filter( 'rank_math/frontend/robots', function ( $robots ) {
$categories = array_map( function ( $category ) {
return $category->slug;
}, get_the_category() );
if ( in_array( 'funny', $categories ) ) {
unset( $robots['index'] );
$robots['noindex'] = 'noindex';
}
return $robots;
} );
The above code is for funny category, replace the funny with the name of your category.
Hope this helps. Let us know if you need any further assistance.
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.