Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
Can you please follow these steps?
1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/xXXhDt
2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server.
That should fix the issue. Please let me know if that does not. We are here to assist.
I don’t think I got the message across; I’m using custom pagination – outside of the /page/2 standard in WordPress.
I would like to mark pages 2 onwards as no index – there is no way of doing this in the Rank Math settings, but I would like to possibly alter the code to check for page_no (query param) and mark as noindex automatically.
Hello,
You could adapt the following filter to check for the query param and if it matches the one you want, you can set that page 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(/* Your conditions go here */){
$robots['index'] = "noindex";
$robots['follow'] = "nofollow";
}
return $robots;
});
Looking forward to help you.
Hey Alberto,
Thanks! that worked well!
I’m curious though it seems like the canonical disappeared once I’ve added this; are they related?
Kindest wishes,
Hello,
We are glad this was helpful.
The canonical tag is only added to pages that are set to index so this should not worry you.
Hope that helps. If you have any further question(s), please let us know. 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.