-
-
Save BoDonkey/da9e979ff6523afaea574e51c9700e0a to your computer and use it in GitHub Desktop.
Allows you to write the error.log right into the wp-content-folder. You can also use something like this to var_dump to your error log: - idWriteLog( $myVar, 'varName' ); - or - idWriteLog( myFunc(), 'funcName' ); - It is especially useful to var_dump ajax requests and will also show you on which filter your current dump is hooked.
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
| <?php | |
| // Add the snippet below in the file wp-config.php right above: /* That's all, stop editing! Happy blogging. */ | |
| define('WP_DEBUG', true ); | |
| if ( WP_DEBUG ) | |
| { | |
| define('SAVEQUERIES', true ); | |
| define('SCRIPT_DEBUG', true ); | |
| define( 'WP_DEBUG_LOG', true ); | |
| define( 'WP_DEBUG_DISPLAY', false ); | |
| if ( ! function_exists( 'idWriteLog' ) ) | |
| { | |
| function idWriteLog( $log, $name = false ) | |
| { | |
| $separator1 = ''; | |
| for ( $i = 0; $i <= 53; $i++ ){ $separator1 .= '#'; } | |
| ob_start(); | |
| echo '---***--- Custom var_dump: ---***---' . "\r\n\r\n"; | |
| echo '### Start' . $separator1 . "\r\n\r\n"; | |
| if ( function_exists( 'current_filter' ) ) | |
| { | |
| echo 'Current Filter: ' . current_filter(); | |
| echo "\r\n\r\n"; | |
| } // end if | |
| echo 'Output: ' . ( $name ? $name : '' ); | |
| echo "\r\n\r\n"; | |
| var_dump( $log ); | |
| echo "\r\n"; | |
| echo '### End '. $separator1 . "\r\n\r\n"; | |
| $result = ob_get_clean(); | |
| error_log( $result ); | |
| } // end idWriteLog | |
| } // end if | |
| } // end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment