Skip to content

Instantly share code, notes, and snippets.

@webaware
Last active May 28, 2020 08:01
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webaware/6520892 to your computer and use it in GitHub Desktop.
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/
<?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.3.0
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
/**
* turn on WP_DEBUG_LOG but without E_STRICT
*/
$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