利用Fix Rss Feeds外掛程式修複WordPress的Feed顯示錯誤

來源:互聯網
上載者:User
今天突然有個網友留言說部落格的Feed掛了,癥狀如下:

Chrome直接開啟訂閱頁面顯示如下:

This page contains the following errors:error on line 1 at column 1: Document is emptyBelow is a rendering of the page up to the first error.

FeedDemon提示:此Feed包含錯誤。

添加後也沒什麼影響,能正常使用。

鮮果閱讀器也可閱讀,但是沒有擷取到最新的文章。

用IE試了下,顯示“文檔頂層存在無效內容。”

查看原始碼發現是能看到HTML格式解析後的內容,這說明WordPress的Feed輸出是沒有問題的,出問題的在於某個檔案的格式。不過要找到是哪個檔案出問題就比較難了。網上給出的解決方案大致都是這樣的:

檢測上、下是否有多餘的斷行符號、分行符號號

1、檢測 wp-config.php 檔案,查看PHP主體之外的代碼有無斷行符號符;

2、同上,檢測 wp-rss2.php,wp-atom.php檔案,如果最近沒修改過,可略過;

3、同上,檢測 functions.php 檔案;

4、注意 feed是有緩衝的,在修改完成之後,發一篇文章,使WP程式重建feed,從而查看效果;

5、若仍然有錯,可以嘗試暫時關閉所有外掛程式,更換主題等逐個排除。

把上述檔案都修改了個遍,還是沒有頭緒。。於是裝了個外掛程式“Fix Rss Feeds”,啟用後修複一下就搞定了。而且修複之後把外掛程式刪了也不會反彈~

研究了下這個外掛程式,似乎只是修改了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' );}?>​

就可以了。

以上就介紹了利用Fix Rss Feeds外掛程式修複WordPress的Feed顯示錯誤,包括了require方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.