WordPress website map sitemap.xml error repair

WordPress website map sitemap.xml error repair

Error overview

In building a website using WordPress, use the XML Sitemaps plug-in to create a sitemap.xml site map, but after creation, open sitemap.xml and report the following error

Solution

1. Find the wp-blog-header.php file in the root directory of the website and open it. Modify it as follows

<?php
if ( ! isset( $wp_did_header ) ) {
	$wp_did_header = true;ob_start();
	// Load the WordPress library.
	require_once __DIR__ . '/wp-load.php';
	// Set up the WordPress query.
	wp(); ob_end_clean();
	// Load the theme template.
	require_once ABSPATH . WPINC . '/template-loader.php';
}

2. Refresh sitemap.xml to find that it can be used


Read More: