警告:您的浏览器不支持或您禁止了脚本。

UUUI

WordPress站点地图sitemap报错的修复方法

WordPress 0 409
相关话题:     

使用WordPress站点地图插件创建站点地图时,发现访问sitamap.xml时报错了,错误提示“error on line 3 at column 6: XML declaration allowed only at the start of the document”(仅在文档开始处允许XML声明)。

处理方法

使用FTP软件获取网站根目录下wp-blog-header.php,使用如下代码替换:

<?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';
}

需要注意的是ob_start();要和$wp_did_header=true;写在同一行。ob_end_clean();要和wp();写在同一行。

声明: 本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、发布本站内容到各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
分享到:

评论

0

您可以访客身份评论,你的电子邮件地址不会被公开。

还没有任何评论,你来说两句吧。
×