利用Fix Rss Feeds插件修復(fù)WordPress的Feed顯示錯誤
今天突然有個網(wǎng)友留言說博客的Feed掛了,癥狀如下:
Chrome直接打開訂閱頁面顯示如下:
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.
FeedDemon提示:此Feed包含錯誤。
添加后也沒什么影響,能正常使用。
鮮果閱讀器也可閱讀,但是沒有獲取到最新的文章。
用IE試了下,顯示“文檔頂層存在無效內(nèi)容。”
查看源代碼發(fā)現(xiàn)是能看到HTML格式解析后的內(nèi)容,這說明WordPress的Feed輸出是沒有問題的,出問題的在于某個文件的格式。不過要找到是哪個文件出問題就比較難了。網(wǎng)上給出的解決方法大致都是這樣的:
檢測上、下是否有多余的回車、換行符號
1、檢測 wp-config.php 文件,查看PHP主體之外的代碼有無回車符;
2、同上,檢測 wp-rss2.php,wp-atom.php文件,如果最近沒修改過,可略過;
3、同上,檢測 functions.php 文件;
4、注意 feed是有緩存的,在修改完成之后,發(fā)一篇文章,使WP程序重建feed,從而查看效果;
5、若仍然有錯,可以嘗試暫時關(guān)閉所有插件,更換主題等逐個排除。
把上述文件都修改了個遍,還是沒有頭緒。。于是裝了個插件“Fix Rss Feeds”,啟用后修復(fù)一下就搞定了。而且修復(fù)之后把插件刪了也不會反彈~
研究了下這個插件,似乎只是修改了WordPress根目錄下的wp-blog-header.php,其實只需將這個文件改為:
<?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' ); } ?>
就可以了。
- WordPress中卸載插件以及移除文章類型組件的代碼示例
- 詳解WordPress中提醒安裝插件以及隱藏插件的功能實現(xiàn)
- WordPress中使主題支持小工具以及添加插件啟用函數(shù)
- 幾個優(yōu)化WordPress中JavaScript加載體驗的插件介紹
- 在WordPress中使用wp-cron插件來設(shè)置定時任務(wù)
- 基礎(chǔ)的WordPress插件制作教程
- WordPress升級版本及安裝插件出現(xiàn)”Problem with the SSL CA cert”的解決辦法
- 推薦十款免費 WordPress 插件
- 用js代碼和插件實現(xiàn)wordpress雪花飄落效果的四種方法
- 在WordPress中安裝使用視頻播放器插件Hana Flv Player
相關(guān)文章
- 前篇文章,我們復(fù)習了php的一些常用的正則表達式,本文,我們來重點介紹下php正則表達式的常用函數(shù),兩者相結(jié)合才可以完美使用哦?。?/div> 2014-08-08
關(guān)于PHP的相似度計算函數(shù):levenshtein的使用介紹
本篇文章小編將為大家介紹,關(guān)于PHP的相似度計算函數(shù) levenshtein的使用介紹,有需要的朋友可以參考一下2013-04-04最新評論