《PHP編程:利用Fix Rss Feeds插件修復(fù)WordPress的Feed顯示錯誤》要點(diǎn):
本文介紹了PHP編程:利用Fix Rss Feeds插件修復(fù)WordPress的Feed顯示錯誤,希望對您有用。如果有疑問,可以聯(lián)系我們。
PHP實(shí)戰(zhàn)本日突然有個網(wǎng)友留言說博客的Feed掛了,癥狀如下:
PHP實(shí)戰(zhàn)Chrome間接打開訂閱頁面顯示如下:
PHP實(shí)戰(zhàn)
This page contains the following errors:
error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.
PHP實(shí)戰(zhàn)FeedDemon提示:此Feed包括錯誤.
PHP實(shí)戰(zhàn)添加后也沒什么影響,能正常使用.
PHP實(shí)戰(zhàn)鮮果閱讀器也可閱讀,然則沒有獲取到最新的文章.
PHP實(shí)戰(zhàn)用IE試了下,顯示“文檔頂層存在無效內(nèi)容.”
PHP實(shí)戰(zhàn)查看源代碼發(fā)現(xiàn)是能看到HTML格式解析后的內(nèi)容,這說明WordPress的Feed輸出是沒有問題的,出問題的在于某個文件的格式.不過要找到是哪個文件出問題就比較難了.網(wǎng)上給出的解決辦法大致都是這樣的:
PHP實(shí)戰(zhàn)檢測上、下是否有過剩的回車、換行符號
PHP實(shí)戰(zhàn)1、檢測 wp-config.php 文件,查看PHP主體之外的代碼有無回車符;
PHP實(shí)戰(zhàn)2、同上,檢測 wp-rss2.php,wp-atom.php文件,如果最近沒改動過,可略過;
PHP實(shí)戰(zhàn)3、同上,檢測 functions.php 文件;
PHP實(shí)戰(zhàn)4、注意 feed是有緩存的,在修改完成之后,發(fā)一篇文章,使WP法式重建feed,從而查看效果;
PHP實(shí)戰(zhàn)5、若仍然有錯,可以測驗(yàn)考試暫時關(guān)閉所有插件,更換主題等逐個排除.
PHP實(shí)戰(zhàn)把上述文件都修改了個遍,還是沒有頭緒..于是裝了個插件“Fix Rss Feeds”,啟用后修復(fù)一下就搞定了.并且修復(fù)之后把插件刪了也不會反彈~
PHP實(shí)戰(zhàn)研究了下這個插件,彷佛只是修改了WordPress根目錄下的wp-blog-header.php,其實(shí)只需將這個文件改為:
PHP實(shí)戰(zhàn)
<必修php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
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' );
}
必修>?
PHP實(shí)戰(zhàn)就可以了.
維易PHP培訓(xùn)學(xué)院每天發(fā)布《PHP編程:利用Fix Rss Feeds插件修復(fù)WordPress的Feed顯示錯誤》等實(shí)戰(zhàn)技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養(yǎng)人才。
轉(zhuǎn)載請注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/8207.html