Last active
November 11, 2018 08:29
-
-
Save debonx/e7543dbb91240533ce91a7d5a64b43ed to your computer and use it in GitHub Desktop.
Fast debugging method with Wordpress.
This file contains hidden or 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
/* | |
* 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