Skip to content

Instantly share code, notes, and snippets.

@slfrsn
Last active December 12, 2017 16:49
Show Gist options
  • Save slfrsn/23f99ed216c2b842049afdcddd55fdba to your computer and use it in GitHub Desktop.
Save slfrsn/23f99ed216c2b842049afdcddd55fdba to your computer and use it in GitHub Desktop.
Logging function for internal WordPress errors. Useful for debugging things that don't print errors to screen, like 'save-post'. Source: https://stackoverflow.com/a/10438630/4941993
if(!function_exists('log_it')){
function log_it( $message ) {
if( WP_DEBUG === true ){
if( is_array( $message ) || is_object( $message ) ){
error_log( print_r( $message, true ) );
} else {
error_log( $message );
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment