WordPress网站地图XML报错的修复方法

原梓番
原梓番
管理员
827
文章
0
粉丝
常用教程评论3,681阅读模式

错误内容如下:error on line 1 at column 6: XML declaration allowed only at the start of the document

此错误处理方法1:文章源自原紫番博客-https://www.yuanzifan.com/54895.html

打开functions.php,找一下有没有 <?php开头,后面是空行什么都没有,然后跟了个 ?>文章源自原紫番博客-https://www.yuanzifan.com/54895.html

把这个删掉。文章源自原紫番博客-https://www.yuanzifan.com/54895.html

此错误处理方法2:文章源自原紫番博客-https://www.yuanzifan.com/54895.html

打开根目录下wp-blog-header.php文章源自原紫番博客-https://www.yuanzifan.com/54895.html

用如下代码替换:文章源自原紫番博客-https://www.yuanzifan.com/54895.html

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

需要注意的是ob_start();吆喝wp_did写在一行。ob_end_clean()要和wp()写在一行。文章源自原紫番博客-https://www.yuanzifan.com/54895.html

文章源自原紫番博客-https://www.yuanzifan.com/54895.html 文章源自原紫番博客-https://www.yuanzifan.com/54895.html

站长微信
扫码添加(注明来意)
weinxin
Yuanzifan99
微信号已复制
原梓番博客公众号
博客内容精选
weinxin
原梓番博客
公众号已复制
 

发表评论

匿名网友
确定

拖动滑块以完成验证