Disabling Strict Standards Errors in WordPress 3.7 with PHP 5.4
In Wordpress 3.7, the function wp_debug_mode
(defined in wp-includes/load.php
, and called from wp-setings.php
) sets error_reporting( E_ALL )
.
Since wp-settings.php
is itself loaded at the end of wp-config.php
, you cannot change this setting from wp-config.php
(or rather, you can, but it will be overridden).
A solution is to create a "Must Use plugin", that is to say a .php file located in the /wp-content/mu-plugins/
folder containing :
<?phpif (WP_DEBUG && WP_DEBUG_DISPLAY) { ini_set('error_reporting', E_ALL & ~E_STRICT & ~E_DEPRECATED);}
I found that only
error_reporting = off
works, as STRICT errors have become part of ALL as of PHP 5.4 which is annoying.
If you set WP_DEBUG to 'false' in wp-config.php file. These do not affect your website.
Bot the problem is that above does not work sometime.That can happen on cheap/shared hostings that force displaying PHP ERRORS, warnings and notices.In that case, you can remove this line from your wp-config.php file:
define('WP_DEBUG', false);
and place this:
ini_set('log_errors','On');ini_set('display_errors','Off');ini_set('error_reporting', E_ALL );define('WP_DEBUG', false);define('WP_DEBUG_LOG', true);define('WP_DEBUG_DISPLAY', false);
in my case its working.