Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
I am really sorry for this late reply. Yes, you could use a code like this one:
/**
* Allows filtering of the robots meta data.
*
* @param array $robots The meta robots directives.
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
global $post;
$postInCategory = false;
foreach((get_the_category()) as $category){
if($category->name == "category name" /* you could add more categories by modifying this if */)
{
$postInCategory = true;
break;
}
}
if($postInCategory == true)
{
$robots['index'] = "noindex";
$robots['follow'] = "nofollow";
}
return $robots;
});
Looking forward to helping you. 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.