問題描述:

在更新 WordPress 或新安裝 WordPress 的時候,在瀏覽器上出現錯誤資訊: “Warning: Cannot modify header information – headers already sent by (output started at /path/blog/wp-config.php:34)

解決方法:

  1. 使用 FTP 下載 wp-config.php 。
  2. 開啟 wp-config.php.
  3. 移除 <?php. 前的空格
  4. 一定要保證第一個位元組是 <?php, 在之前不要有空格。

    Header Error - 10 Most Common WordPress Errors (+Solutions)

  5. 移除 ?> 之後的空格。
  6. 保證最後的位元組是 ?>, 在其後不要有空格。

    Header Error - 10 Most Common WordPress Errors (+Solutions)

這個錯誤也會在其它檔案內出現,特別是函式檔案 functions.php 檔案內。如出現 RSS 錯誤,一般透過此方法也會得到解決。