Created
January 28, 2023 18:36
-
-
Save derekashauer/806d0c7ef709b959438a5228db2aac22 to your computer and use it in GitHub Desktop.
WordPress log function
This file contains 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
function _log( $message, $pre = '' ) { | |
if ( true === WP_DEBUG && !defined( 'DOING_CRON' ) && !defined( 'DOING_AJAX' ) ) { | |
if ( $pre ) { | |
error_log( $pre ); | |
} | |
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