Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ashwebstudio
Created January 28, 2023 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashwebstudio/806d0c7ef709b959438a5228db2aac22 to your computer and use it in GitHub Desktop.
Save ashwebstudio/806d0c7ef709b959438a5228db2aac22 to your computer and use it in GitHub Desktop.
WordPress log function
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