Skip to content

Instantly share code, notes, and snippets.

@debonx
Last active November 11, 2018 08:29
Show Gist options
  • Save debonx/e7543dbb91240533ce91a7d5a64b43ed to your computer and use it in GitHub Desktop.
Save debonx/e7543dbb91240533ce91a7d5a64b43ed to your computer and use it in GitHub Desktop.
Fast debugging method with Wordpress.
/*
* Put this function in your plugin or functions.php and pass the parameter $log to be debugged.
* Example: wpui_write_log( $log ) where $log is the data to be debugged.
* It writes into /debug.log of your wp-content/
* Could be used as class method as well
*/
function wpui_write_log( $log ) {
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