五一在家休息,中午出去一趟,回来后查看博客Feed的时候,发现页面打开错误,紧接着查看了sitemap.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.
截图:
网上查询一番,说是<?php ... ?>
标记前后有空格造成的,可是主题修改过程中对这块儿并没有改动,把主题每个文件都看了已边,还是没有发现有空格的地方,后来觅得此方法:
修改网站根目录下wp-blog-header.php
文件,
在
$wp_did_header = true;
下方添加:ob_start();
,在
wp();
前面添加:ob_end_clean();
,完整如下:
<?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' ); } ?>
看来还是得常常检查啊,免得订阅了都获取不到更新文章。。。
嗯嗯 我前几天就出现了这个问题 不知道只能弄
也有可能是bom头问题
@不给力的面条 是吧。之前从来没碰到过。。。
很不错,学习了