Plugin support

#1035351
  • Resolved clare recipes
    Rank Math free

    I’m still experiencing an issue with Google Search Console refusing to index the following sitemap:
    https://claresrecipes.com/category-sitemap.xml

    Google reports that the URL contains the header:

    makefile
    Copier
    Modifier
    X-Robots-Tag: noindex
    I have followed your previous advice and added this filter in my functions.php:

    php
    Copier
    Modifier
    add_filter( ‘rank_math/sitemap/enable_caching’, ‘__return_false’ );
    However, the issue persists.

    I also contacted my hosting provider (Cloudways), who confirmed that:

    There are no Varnish, NGINX, or server-level rules injecting this header

    The X-Robots-Tag: noindex header is coming from the application (WordPress)

    I even disabled Rank Math temporarily and the header disappeared — which confirms that the plugin is still injecting it.

    Could you please advise how to completely remove or override this X-Robots-Tag: noindex header from the sitemap?
    Should I also try using this filter?

    php
    Copier
    Modifier
    add_filter( ‘rank_math/sitemap/x_robots_tag’, ‘__return_false’ );

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    I apologize for the issue you are facing with your sitemap and the X-Robots-Tag: noindex header. Thank you for providing detailed information about the steps you’ve already taken.

    To address the issue, you can indeed try using the filter you mentioned:

    add_filter( 'rank_math/sitemap/x_robots_tag', '__return_false' );

    This filter is specifically designed to control the X-Robots-Tag header for sitemaps generated by Rank Math. Adding this to your functions.php file should help in removing or overriding the noindex directive.

    After adding this filter, please ensure to clear your website cache and check if the header is still present in your sitemap. If the issue persists, it may be beneficial to review any other plugins or custom code that might be affecting the headers.

    If you continue to experience difficulties, please reply to this ticket, and a human agent from our support team will assist you further.

    Thank you for your patience, and we hope to resolve this issue for you soon!

    Sources:
    Can I NoIndex PDF Files Using an SEO Plugin? » Rank Math

    Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    Please note that the sitemaps are by default set to Noindex as they are meant to be crawled and not to be displayed on search results pages.

    You should only submit your sitemap to the sitemap section of your GSC account and shouldn’t use the URL inspection tool for the sitemap URLs.
    https://rankmath.com/kb/submit-sitemap-to-google/

    In case you still want to index your sitemap, you can use the following filter on your website:

    add_filter( 'rank_math/sitemap/http_headers', function( $headers ) {
    	if ( '/sitemap_index.xml' !== $_SERVER['REQUEST_URI'] ) {
    		return $headers;
    	}
    	unset( $headers['X-Robots-Tag'] );
    	return $headers;
    } );
    

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    After applying the filter, please clear your sitemap cache by following this screencast: https://i.rankmath.com/pipRDp

    Let us know how it goes. Looking 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.

Viewing 2 replies - 1 through 2 (of 2 total)

The ticket ‘Plugin support’ is closed to new replies.