TSYBLOG.COM

站点地图sitemap.xml提示“This page contains the following errors:”的解决办法

最近一直再折腾站点地图,总算搞的差不多了,竟然发现打开xml文件竟然错误,错误如下:

This page contains the following errors:

error on line 1 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.

%title插图%num

解决方法如下:

打开“wordpress”根目录下的“wp-blog-header.php”文件,在

$wp_did_header = true;

代码下加入以下代码:

ob_start();

在以下代码下

wp();

加入以下代码

ob_end_clean();

最后完整的“wp-blog-header.php”文件因为如以下代码这样:

xml文件使用浏览器打开,提示“This page contains the following errors:”的解决办法
<?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地图出错的问题就已经解决了。PS:但当wordpress有更新的时候它会自动更新上面代码中改动过的几处就又还原了,下面给出几点禁止wordpress自动更新的方法:禁止wordpress后台自动更新的方式方法  (可直接点开参阅哦)


喜欢本文?
文章阅读
常见问题
免费下载或者VIP会员专享资源能否直接商用?
提示下载完成但无法解压?
投稿及掉连解决方法:

本站均测试后上架,保证所提供下载的资源的准确性、安全性和完整性。

如有链接无法下载、失效或广告,下方评论区留言,或联系客服处理,看到处理!

如果您也有好的资源或教程,您可以投稿发布,所得成本报酬归发布方所有!

发表评论