-
I’m working on a WordPress website for a real estate company. The property detail pages use the pages post type but seem to run off a pretty heavily customised standalone page template. The property details pages are not setup as pages in wordpress as they pull their information from custom tables in the database into the custom temnplate file.
I’ve just realised that since moving to Rank Math from Yoast, the property detail pages have been using a robots meta tag of ‘follow,noindex’ and not ‘follow,index’ as the normal wordpress pages use.
As a result all property detail pages have disappeared from Google.
If I disable the Rank Math plugin the problem fixes itself, but when I re-enable it the problem returns, so it seems that Rank Math is the cause of the problem.
I have checked and tested every available option in Rank Math but I’m unable to force the custom pages to index. The standard wordpress pages are set to be indexed.
I found some filter code recommended for a similar type problem:
/**
* 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(get_post_type() == “page”){
$robots[‘index’] = “index”;
$robots[‘follow’] = “follow”;
return $robots;
}
return $robots;
});This fixed the problem but it then forced pages that have been set to ‘noindex’ to be indexable. So now I have the reverse problem.
Is there a reason why Math Rank would be forcing a page to noindex and is there a way to override this just for the property detail pages?
The ticket ‘Rank Math Force Noindexing a Customised Page Template’ is closed to new replies.