如何啟用Wordpress Debug Log
在 wp-config.php 添加 define
define( 'WP_DEBUG', true );define( 'WP_DEBUG_DISPLAY', false );define( 'WP_DEBUG_LOG', '/srv/www/all-debug.log' );
使用 Log
error_log( 'Hello World!' );
當要印變數使用
error_log( print_r( 'Hello World!', true ) );
error_log 的定義
PHP 本身自帶功能,並非 Wordpress 所定義的函數。