Google Search Console flag a submitted URL marked ‘noindex’ error for the HTML map, the error confused me a few days. After searching a lot of information, fix the sitemap.xml noindex problem.

The case is that I resubmit the sitempa.xml of w3cgeek.com to Google Search Console. However, the error that submitted URL marked ‘noindex’ occurs.

I always using the WordPress plugin Google sitemap generator to generate the sitempa.xml file. Recently, I updated the Google sitemap generator plugin, and find the Google Search Console noindex error.

First, I tried to deactivate the Google sitemap generator plugin to generate a sitemap.xml file in the Yoast SEO plugin. However, the error still exists.

Some friends tell me to use the SEO all in one plugin, I tried the way, but not solved the problem.

Finally, I chose to use the Google sitemap generator plugin to generate the sitemap.xml, and find the method to solve the Google Search Console flag a submitted URL marked ‘noindex’ error.

The solution is to comment the code line in the sitemap-core.php file.

//Do not index the actual XML pages, only process them.
//This avoids that the XML sitemaps show up in the search results.
if(!headers_sent()) header('X-Robots-Tag: noindex', true, 200);

Change the above code as the bellow code:

//Do not index the actual XML pages, only process them.
//This avoids that the XML sitemaps show up in the search results.
#if(!headers_sent()) header('X-Robots-Tag: noindex', true, 200);

Now, to regenerate the sitemap.xml file, then inspect the URL of the sitemap.xml on Google Search Console.

You will see it’s ok! If you have a better solution to WordPress sitemap.xml noindex in Google Search Console, let me know.