Created
November 24, 2020 23:41
-
-
Save cesgarma/3c2928c58eba636faeb3817c20ab56ce to your computer and use it in GitHub Desktop.
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
/** | |
* | |
* Utility function to print to log file when using Ajax | |
* | |
* Log Location: /wp-content/debug.log | |
* | |
* Remember to enable Debug Log in the wp-config.php file: | |
* | |
* define ('WP_DEBUG_LOG', true); | |
* | |
*/ | |
function log_to_file($logstring){ | |
$DEBUG_THEME = true; | |
if ($DEBUG_THEME) { | |
ob_start(); | |
var_dump( $logstring ); | |
$contents = ob_get_contents(); | |
ob_end_clean(); | |
error_log($contents); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment