wp 5.9區塊編輯器變空白頁

期待已久的 WordPress 5.9在2022.1.25終於來了,支持整站編輯,剛更新就發生了最重要的編輯器不能打開的問題。折騰了一番,終於找到問題所在,謹記下以備忘。

之前,參考某站的優化措施 (https://free.com.tw/wordpress-optimization-guide/),其中一條是“移除掉不必要的查詢參數”,在 「.htaccess」中加入了以下幾行:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} !=””
RewriteCond %{QUERY_STRING} !^p=.*
RewriteCond %{QUERY_STRING} !^s=.*
RewriteCond %{REQUEST_URI} !^/wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]




Hello everyone,

my hosting provider kinda solved the issue adding the following line:
Header always set Content-Security-Policy "upgrade-insecure-requests;"
in subfolder’s .htaccess (outside BEGIN/END WordPress of course).

So, just to summarize the things to check (most of them are obvious):

  1. You should specify your subfolder in root’s index.php require statement
    require __DIR__ . '/(your_subfolder)/wp-blog-header.php';
  2. Root’s .htaccess should be left as it is when WP creates it.
  3. Subfolder’s index.php should not have the /(your_subfolder) part in its require statement.
  4. Subfolder’s .htaccess should contain the line I mentioned at the beginning.
  5. In WP Settings > General you should state your subfolder’s name in WP’s URL and not state it in website’s URL (as you normally would with a subfolder installation).

For those interested in delving into the .htaccess statement, here’s MDN link.


有人用 http 就能正常,用 https 就出錯,有這方面問題的可以試試朝「混合安全和非安全內容在同一網頁」這方面想想,或去這裡看看: install plugins that automatically redirect all the we HTTP requests to HTTPS requests

我也試過在Chrome安裝過某些油猴插件(Tampermonkey Plugin)導致白頁,可以先把Chrome 的所有插件包括Tampermonkey關掉,也許就能解決問題。