error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.
添加后也没什么影响,能正常使用。
查看源代码发现是能看到HTML格式解析后的内容,这说明wordpress的Feed输出是没有问题的,出问题的在于某个文件的格式。不过要找到是哪个文件出问题就比较难了。网上给出的解决方法大致都是这样的:
检测上、下是否有多余的回车、换行符号
1、检测 wp-config.php 文件,查看PHP主体之外的代码有无回车符;
2、同上,检测 wp-RSS2.PHP,wp-atom.PHP文件,如果最近没修改过,可略过;
4、注意 Feed是有缓存的,在修改完成之后,发一篇文章,使WP程序重建Feed,从而查看效果;
5、若仍然有错,可以尝试暂时关闭所有插件,更换主题等逐个排除。
把上述文件都修改了个遍,还是没有头绪。。于是装了个插件“Fix RSS Feeds”,启用后修复一下就搞定了。而且修复之后把插件删了也不会反弹~
研究了下这个插件,似乎只是修改了wordpress根目录下的wp-blog-header.PHP,其实只需将这个文件改为:
PHP;">
if ( !isset($wp_did_header) ) {
$wp_did_header = true;
ob_start(); //2010-09-18 gofunnow.com added,it will Fix rss feed error "Error on line 2: The processing instruction target matching "[xX][mM][lL]" is not allowed." while burn feed from feedburner.com
require_once( dirname(FILE) . '/wp-load.php' );
ob_end_clean(); //2010-09-18 gofunnow.com added,it will Fix rss feed error "Error on line 2: The processing instruction target matching "[xX][mM][lL]" is not allowed." while burn feed from feedburner.com
wp();
require_once( ABSPATH . WPINC . '/template-loader.php' );
}
?>
$wp_did_header = true;
ob_start(); //2010-09-18 gofunnow.com added,it will Fix rss feed error "Error on line 2: The processing instruction target matching "[xX][mM][lL]" is not allowed." while burn feed from feedburner.com
require_once( dirname(FILE) . '/wp-load.php' );
ob_end_clean(); //2010-09-18 gofunnow.com added,it will Fix rss feed error "Error on line 2: The processing instruction target matching "[xX][mM][lL]" is not allowed." while burn feed from feedburner.com
wp();
require_once( ABSPATH . WPINC . '/template-loader.php' );
}
?>
就可以了。
原文链接:https://www.f2er.com/php/20741.html