上週將Wordpress升級至最新的5.6版後,網站狀態欄位就一直顯示有建議改進項目,
說是”這個網站的回送要求無法完成”,抽空將網站的外掛一個個停用測試後,
總算發現問題出在資訊安全相關的”All In One WP Security & Firewall“上;
到該外掛的支援論壇搜索後發現已有不少橫跨各國的使用者回報此問題,
然而該警告似乎源自於Wordpress5.6的核心功能改動,以至於作者無法藉由更新來解決…..
不過今日回頭檢視如何處理該警告的討論串時,終於發現在另一個資安外掛”iThemes Security “的支援論壇中,
有網友提出了”將回送要求以之前方式回傳”的方法,確實能(暫時)解決這個問題!
(以下內容引述自Loopback Issue (After Updating to WP 5.6))
…..According to the WordPress 5.6 Field Guide, there are 11 Site Health updates in WP 5.6…..
…..The one I noticed was ticked #48105: Move Site Health async checks to a REST API endpoint.
Why? While digging through the Site Health code I noticed there are 2 types of Site Health tests: direct and async.
And the loopback request test is of type async…..
…..So apparently in WP 5.6 the async loopback request test started using a REST API endpoint.
This must be the explanation why the loopback request test is functioning properly in WP 5.5.x
but conflicts with the Hide Backend module of the iTSec plugin in WP 5.6.
Then I started wondering … Is there any way I can temporarily revert to the method used in WP 5.5.x ?
And the answer is … YESSS there is……
…..Check it out:
add_filter( ‘site_status_tests’, ‘revert_async_loopback_requests_test’, 10, 1 );
function revert_async_loopback_requests_test( $test_type ) {
$test_type[‘async’][‘loopback_requests’][‘test’] = ‘loopback_requests’;
$test_type[‘async’][‘loopback_requests’][‘has_rest’] = false;
return $test_type;
}
Put this code snippet in the functions.php file of your active theme or in a code snippets plugin and voila!
The loopback request test no longer produces an error in WP 5.6…..
…..Note this is not a fix, just a temporary workaround.
Also there is a lot more to tell about this issue but I’ll leave that for another post.
Try the workaround and let me know your result(s)…..
…..
只要將該段程式碼放到佈景主題的functions.php中即可,
若有使用之前介紹過的”Code Snippets“這個外掛,也能直接在其中新增:
儲存該程式碼片段後,”回送要求無法完成”的警告也確實順利消失了!
雖然這段程式碼能處理這個問題,但Wordpress沒更新的話也只是治標不治本…..
這次的Wordpress 5.6版升級似乎讓不少外掛都出了大小不一的故障,論壇上一片哀嚎,
除了”All In One WP Security & Firewall”,個人使用的”Classic Editor”也有文章無法上下滑動的問題,
需要特別安裝外掛”Enable jQuery Migrate Helper”以使用舊版jQuery才能暫時解決,
不曉得Wordpress團隊近期會否針對這些部份做出修改…..