Last active
December 23, 2024 02:31
-
-
Save webaware/6520892 to your computer and use it in GitHub Desktop.
Turn on WordPress' WP_DEBUG_LOG but without E_STRICT. Accompanying blog post: http://snippets.webaware.com.au/snippets/wordpress-wp_debug_log-without-e_strict/
This file contains 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 | |
/* | |
Plugin Name: Debug Log Not Strict | |
Plugin URI: https://gist.github.com/webaware/6520892 | |
Description: Turn on WP_DEBUG_LOG but without E_STRICT | |
Version: 1.4.0 | |
Author: WebAware | |
Author URI: https://shop.webaware.com.au/ | |
*/ | |
/** | |
* turn on WP_DEBUG_LOG but without E_STRICT | |
*/ | |
$ignore = 0; | |
if (version_compare(PHP_VERSION, '8.4', '<')) { | |
$ignore |= E_STRICT; | |
} | |
if (defined('DEBUG_IGNORE_DEPRECATED') && DEBUG_IGNORE_DEPRECATED) { | |
// also ignore PHP deprecated notices | |
$ignore |= E_DEPRECATED; | |
} | |
if (defined('DEBUG_IGNORE_WP_DEPRECATED') && DEBUG_IGNORE_WP_DEPRECATED) { | |
// also ignore WordPress deprecated notices | |
add_filter('doing_it_wrong_trigger_error', '__return_false'); | |
} | |
error_reporting(E_ALL ^ $ignore); | |
ini_set('log_errors', 1); | |
ini_set('display_errors', 0); | |
ini_set('error_log', WP_CONTENT_DIR . '/debug.log'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment