Skip to content

Instantly share code, notes, and snippets.

@MasterHans
Created June 19, 2022 13:52
Show Gist options
  • Save MasterHans/50e8dcd82f051a4af11b309447534572 to your computer and use it in GitHub Desktop.
Save MasterHans/50e8dcd82f051a4af11b309447534572 to your computer and use it in GitHub Desktop.
Wordpress - switch on log writing
/**
* 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