Skip to content

Instantly share code, notes, and snippets.

@tarex
Last active August 29, 2015 14:05
Show Gist options
  • Save tarex/ed1f1e1b76080dc2afac to your computer and use it in GitHub Desktop.
Save tarex/ed1f1e1b76080dc2afac to your computer and use it in GitHub Desktop.
Add custom log into WordPress

add these lines to wp-config.php

//Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

//Disable display of errors and warnings 
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);
<?php
if(!function_exists('_log')){
function _log( $message ) {
if( WP_DEBUG === true ){
if( is_array( $message ) || is_object( $message ) ){
error_log( print_r( $message, true ) );
} else {
error_log( $message );
}
}
}
}
// use this as _log('your message');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment