WordPress 2.0.6 對 FeedBurner 的 bug

才一升級就出包…XD

剛看到這篇文章,大意是說 WordPress 升級到 2.0.6 或 2.1 beta 時,FeedBurner 有時候來抓 feed 時會出包吐出:invalid xml 字樣,所以當別人透過 FeedBurner 來讀你的 feed 時偶而會有挫塞的情況,所以文章中就提供了兩個解決的方法:

  1. 修改 wp-includes/functions.php 然後找到這段:

    
    if ( substr(php_sapi_name(), 0, 3) == ‘cgi’ )
      @header("HTTP/1.1 $header $text");
    else
      @header("Status: $header $text");
    

    然後把它改成下面這樣:

    
    // if ( substr(php_sapi_name(), 0, 3) == ‘cgi’ )
      @header("HTTP/1.1 $header $text");
    // else
    //  @header("Status: $header $text");
    

    也就是只留下 @header("HTTP/1.1 $header $text"); 這一行。

  2. 另一個方式,如果你覺得更動 WordPress 的程式碼很不乾淨的話,你可以自己建立一個檔案(比方說 FeedBurner.php),然後內容如下:

    
    <?php
      $uri="http://yourdomain.name/feed/"; //Replace this URI with the URI to *your* feed!!
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $uri);
      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
      echo curl_exec($ch);
      $status = curl_close($ch);
    ?>
    

    檔案儲存後(這個檔案不能被 cache),記得到 FeedBurner 裡去設定你的 feed 位址為 http://yourdomain.name/FeedBurner.php 就可以了。

有升級 WordPress 2.0.6 及使用 FeedBurner 的人趕快修復這個 bug 吧!

 

歷史上的今天

4 Responses to “WordPress 2.0.6 對 FeedBurner 的 bug”


Leave a Reply