WordPress debugging
问题 How can I write debug messages from my WordPress plugin? Debugging in WordPress describes how can I enable the wp-content/debug.log file. But how can I write to it? Is there any logging method like wp_log($msg) or something? I didn't find such. 回答1: If WP_DEBUG_LOG is set to true, the error_log-INI setting is set: ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' ); To write to that file, you can use the error_log-function: error_log("This message is written to the log file"); This function