WordPress sitemap地图插件出现This page contains the following errors错误

今天发现sitemap xml地图插件,出现This page contains the following errors错误,这个插件我从几年前就开始用了,中间从来没出过问题,今天心血来潮想访问一下xml地图,结果出现如下错误:

经过一番研究解决了这个错误,具体什么原因就不细说了,相信各位站长也不关心这个,我就直接给出解决方案。

1、找到“wordpress”根目录下的“wp-blog-header.php”文件,查找:

$wp_did_header = true;

在此代码后面加入:

ob_start();

2、再查找:

wp();

在此代码的下一行添加:

ob_end_clean();

如果你懒得一个个查找替换,可以直接全选删除文件中的代码,然后复制下面的代码放进去,保存,就OK了

<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */
 
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';
 
}

猜你喜欢

转载自blog.csdn.net/t1174148618/article/details/116847153