您的位置 首页 wordpress教程

wordpress地图sitemap错误无法生成的解决方法

今天在生成wordpress地图sitemap.xml的时候出现错误,错误代码如下:

20190903162108.jpg

Markup
This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

修改方法很简单,找到根目录下面的wp-blog-header.php文件改成如下代码:

PHP
<?php
/** * Loads the WordPress environment and template. * * @package WordPress */
if ( !isset($wp_did_header) ) { 
$wp_did_header = true; ob_start(); 
require_once( dirname(__FILE__) . '/wp-load.php' ); ob_end_clean(); 
wp(); require_once( ABSPATH . WPINC . '/template-loader.php' );
}

就可以解决了。

wordpress地图