Write log in wordpress:
functions.php:
if (!function_exists('write_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);
}
}
}
}
Then call write_log() in below way:
write_log("SOME TEXT");
Or
write_log($variable_to_test);
.:Happy coding:.
No comments:
Post a Comment