Hello,
Thank you for contacting Rank Math today.
You can add a noindex tag to the page by editing the individual pages and checking the noindex checkbox in Rank math meta box under Advanced tab.
This will automatically remove the pages from the sitemap.
Looking forward to helping you. Thank you.
Hello, this is for any posts that fall in a certain category. Is there a way to do this via the hook method instead of us having to edit every single post to accomplish this? Thanks!
Hello,
You could add the following code replacing your-category-slug
with the slug of the category you want all its posts as no-index.
/**
* Allows filtering of the robots meta data.
*
* @param array $robots The meta robots directives.
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
global $post;
// filter for only a specific post type
if(in_category('your-category-slug')){
$robots['index'] = "noindex";
$robots['follow'] = "nofollow";
return $robots;
}
return $robots;
});
Looking forward to help you.
Thanks for the response – it seems the above code doesn’t work, unfortunately.
Hello,
Then we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping 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.