Skip to content

Instantly share code, notes, and snippets.

@DenisJunio
Created January 10, 2020 17:48
Show Gist options
  • Save DenisJunio/f7419122fe084991bac7ce9e2cc1ddf0 to your computer and use it in GitHub Desktop.
Save DenisJunio/f7419122fe084991bac7ce9e2cc1ddf0 to your computer and use it in GitHub Desktop.
WordPress Debug - function "write_log"
<?php
if ( ! function_exists( 'write_log' ) ) {
/**
* Write Log.
*
* @param string|array|object $log 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