Created
June 19, 2022 13:52
-
-
Save MasterHans/50e8dcd82f051a4af11b309447534572 to your computer and use it in GitHub Desktop.
Wordpress - switch on log writing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* enable log writing | |
* // Enable WP_DEBUG mode | |
define( 'WP_DEBUG', true ); | |
// Enable Debug logging to the /wp-content/debug.log file | |
define( 'WP_DEBUG_LOG', true ); | |
define( 'WP_DEBUG_DISPLAY', false ); | |
*/ | |
if (!function_exists('write_log')) { | |
function write_log($log) | |
{ | |
if (true === WP_DEBUG) { | |
if (is_array($log) || is_object($log)) { | |
error_log(print_r($log, true)); | |
} else { | |
error_log($log); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment