
前言介紹
- 這款 WordPress 外掛「WP Debugging」是 2019-02-02 上架。
- 目前有 10000 個安裝啟用數。
- 上一次更新是 2024-12-02,距離現在已有 450 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 5.2 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
- 有 19 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
afragen |
外掛標籤
內容簡介
此外掛在啟用時會在 wp-config.php 中設定以下偵錯常數,並在停用時移除它們。任何錯誤都會導致拋出 PHP Exception。偵錯常數請參考 WordPress 的「Debugging in WordPress」頁面。
預設設定如下:
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );
啟用此外掛時也會設置 `@ini_set( 'display_errors', 1 )`。當此外掛首次運行時,`WP_DEBUG` 會設置為 true;之後便可在設定中關閉。
使用者可以在設定頁面中設置以下項目:
define( 'WP_DEBUG', true ); //(設定此項目)初始安裝時為預設值。
define( 'WP_DEBUG_DISPLAY', false ); //(未指定時的預設值為)true。
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true ); //WordPress 5.2 白屏處理。
當停用此外掛時,會盡力恢復先前存在的常數為其原狀。啟用此外掛時,會恢復預設值和任何已保存的設定。
此外掛使用 wp-cli/wp-config-transformer 命令將常數寫入 wp-config.php。
隨附此外掛的 Andrew Norcross 的「Debug Quick Look」有助於讀取 debug.log 檔案。若已安裝該外掛,但 WP 偵錯未啟用,應刪除它。
「Query Monitor」和「Debug Bar」外掛是可選依賴關係,有助於除錯和疑難排解。若已忽略安裝通知,45 天後會再次提醒。
如您的 wp-config.php 檔案位於非標準位置,可以使用 wp_debugging_config_path 過濾器來返回您的安裝檔案路徑。
wp_debugging_add_constants 過濾器可讓使用者向 wp-config.php 添加常數。
過濾器返回一個陣列,其中鍵是常數名稱,而值是包含作為字符串和指示是否應傳遞而不帶引號的布林值的數據陣列。
$my_constants = [
'my_test_constant' =>
[
'value' => 'abc123',
'raw' => false,
],
'another_test_constant' => [ 'value' => 'true' ],
];
value 選項包含常數的值作為字符串。
raw 選項表示,不是將值作為字符串放入 config 中,而是不加引號地放入。預設值為 true。對於非布林值,可將其設為 false。
例如:
add_filter(
'wp_debugging_add_constants',
function( $added_constants ) {
$my_constants = [
'my_test_constant' => [
'value' => '124xyz',
'raw' => false,
],
'another_test_constant' => [ 'value' => 'true' ],
];
return array_merge( $added_constants, $my_constants );
},
10,
1
);
這將創建以下常數:
define( 'MY_TEST_CONSTANT', '124xyz' );
define( 'ANOTHER_TEST_CONSTANT', true );
開發中。
原文外掛簡介
This plugin sets the following debug constants in wp-config.php on plugin activation and removes them on plugin deactivation. Any errors will result in a PHP Exception being thrown. Debug constants per Debugging in WordPress.
Default settings:
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );
@ini_set( ‘display_errors’, 1 ); is set when the plugin is active. WP_DEBUG is set to true when the plugin is first run, thereafter it can be turned off in the Settings.
The Settings page allows the user to set the following.
define( 'WP_DEBUG', true ); // Default on initial plugin installation.
define( 'WP_DEBUG_DISPLAY', false ); // Default when not declared is true.
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true ); // WordPress 5.2 WSOD Override.
When the plugin is deactivated best efforts are made to re-add pre-existing constants to their former state. When the plugin is activated the default settings and any saved settings are restored.
This plugin uses the wp-cli/wp-config-transformer command for writing constants to wp-config.php.
Debug Quick Look from Andrew Norcross is included with this plugin to assist in reading the debug.log file. If you already have this plugin installed you should delete it when WP Debugging is not active.
Query Monitor and Debug Bar plugins are optional dependencies to aid in debugging and troubleshooting. The notice for installation will recur 45 days after being dismissed.
If you have a non-standard location for your wp-config.php file you can use the filter wp_debugging_config_path to return the file path for your installation.
The filter wp_debugging_add_constants allows the user to add constants to wp-config.php.
The filter returns an array where the key is the name of the constant and the value is an array of data containing the value as a string and a boolean to indicate whether or not the value should be passed without quotes.
$my_constants = [
'my_test_constant' =>
[
'value' => 'abc123',
'raw' => false,
],
'another_test_constant' => [ 'value' => 'true' ],
];
The value option contains the constant’s value as a string.
The raw option means that instead of placing the value inside the config as a string it will become unquoted. The default is true. Set as false for non-boolean values.
Example:
add_filter(
'wp_debugging_add_constants',
function( $added_constants ) {
$my_constants = [
'my_test_constant' => [
'value' => '124xyz',
'raw' => false,
],
'another_test_constant' => [ 'value' => 'true' ],
];
return array_merge( $added_constants, $my_constants );
},
10,
1
);
This will create the following constants.
define( 'MY_TEST_CONSTANT', '124xyz' );
define( 'ANOTHER_TEST_CONSTANT', true );
Development
PRs are welcome against the develop branch on GitHub.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WP Debugging」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
2.2.0 | 2.3.0 | 2.4.0 | 2.4.1 | 2.4.2 | 2.4.3 | 2.5.0 | 2.5.1 | 2.5.3 | 2.5.4 | 2.5.5 | 2.5.6 | 2.5.7 | 2.5.8 | 2.6.0 | 2.6.1 | 2.7.0 | 2.7.1 | 2.7.2 | 2.8.0 | 2.9.0 | 2.9.1 | 2.9.2 | trunk | 2.10.0 | 2.10.1 | 2.10.2 | 2.11.0 | 2.11.1 | 2.11.2 | 2.11.3 | 2.11.4 | 2.11.5 | 2.11.6 | 2.11.7 | 2.11.8 | 2.11.9 | 2.12.0 | 2.12.1 | 2.12.2 | 2.11.10 | 2.11.11 | 2.11.12 | 2.11.13 | 2.11.14 | 2.11.15 | 2.11.16 | 2.11.17 | 2.11.18 | 2.11.19 | 2.11.20 | 2.11.21 | 2.11.22 | 2.11.23 | 2.11.24 |
延伸相關外掛(你可能也想知道)
WP Crontrol 》WP Crontrol 可以讓您查看和控制 WP-Cron 系統中正在發生的事件。從管理界面,您可以:, , 查看所有的 Cron 事件以及它們的參數、循環間隔時間、回撥函數以及...。
Query Monitor – The developer tools panel for WordPress 》ministrator user). This cookie can be set by defining QM_AUTH_KEY in your wp-config.php file., To learn more about how to use Query Monitor, please...。
P3 (Plugin Performance Profiler) 》這個外掛程式可以創建您 WordPress 網站的外掛程式效能概況,並且藉由測量這些外掛對網站載入時間的影響。通常WordPress網站由於過多或配置不佳的外掛程式而...。
Debug Bar 》在管理列上新增一個除錯選單,顯示查詢、快取及其他有用的除錯資訊。, 開發者必備的外掛!, 當啟用WP_DEBUG時,也會追蹤 PHP 的警告和注意事項,使它們更容易...。
Debug Log Manager – Conveniently Monitor and Inspect Errors 》Debug Log Manager 可以讓您:, , 單擊啟用 WP_DEBUG 以記錄 PHP、數據庫和 JavaScript 錯誤,不需要手動編輯 wp-config.php 文件,完成後再禁用。 , 在自訂...。
My WP Customize Admin/Frontend 》這個外掛讓管理者和前端使用者都能輕鬆地進行自訂設定。許多自訂篩選器和操作,還包含開發者工具。, 示範網站在這裡:https://tastewp.com/new/?pre-installe...。
Code Profiler – WordPress Performance Profiling and Debugging Made Easy 》一個可以測量 WordPress 外掛與佈景主題效能的分析工具。, Code Profiler 可以協助您在 PHP 層面上測量您的外掛與佈景主題的效能,並快速找到任何潛在的 Word...。reBusted! 》這個外掛可以免去你問「你有清空快取嗎?」的問題。, 這是根據原本由 Paul Clark 開發的外掛更新,以符合今天的 WordPress 和 PHP。, 功能, , 在線上網站上安...。
Plugin Detective – Troubleshooting Conflicts 》Plugin Detective 可以幫助您快速且輕鬆地排除網站上的問題,並找出問題的原因。一旦找到罪犯,您可以快速停用有問題的外掛程式。甚至當您的網站出現白屏、致...。
which template file 》想知道 WordPress 在前台顯示頁面時使用哪個模板嗎?, 這個外掛可以幫您達成這個目的。您可以在免費的模擬網站上嘗試使用:點此連結 => https://tastewp.c...。
Dashboard Widgets Suite 》插件名稱:Dashboard Widgets Suite(控制面板小工具套裝), , 該外掛提供 1 個插件與 9 個小工具,可簡化您的工作流程並提高工作效率。該套裝小工具包括以下...。
Debug Log – Manager Tool 》這是一個簡單的除錯日誌外掛程式,您可以在儀表板中檢查除錯日誌。透過一個點擊,您可以啟用或停用除錯功能(例如 ‘ WP_DEBUG’、‘WP_DEBUG...。
WP Safe Mode 》WP Safe Mode 可讓您暫時停用/啟用特定外掛,並切換到其他佈景主題以檢視您的網站。, 如果您遇到特定外掛或佈景主題的問題並需要進行疑難排解,但又不想影響...。
Template Debugger 》你是否常常感到困惑,想知道你正在編輯的模板檔案是哪一個?你曾經因為不確定 WordPress 是否正在使用你期望的檔案而印出一些文字嗎?, 如果是的話,試試這個...。Monkeyman Rewrite Analyzer 》這是一個了解你的重寫規則(“美麗連結”)的工具。如果你正在添加或修改規則,並想要了解它們的運作方式(或者為什麼它們不起作用),這個工具是必不可少的。,...。
