Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When I set WP_DEBUG to true in wp-config.php, I get to see all the strict standards and deprecated messages.

I've set the error_reporting in my php.ini, ini_set() and error_reporting() to E_ERROR | E_WARNING | E_PARSE. But I still get to see the strict standards messages.

I know the messages can be useful, but they appear in some of the plugins I am using and I am not interested in seeing them. How do I disable them?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Just don’t set WP_DEBUG to TRUE. The error level is set in wp_debug_mode(), which is called in wp-settings.php before any plugins are loaded. If you leave the default values WordPress will set it to:

error_reporting( 
    E_CORE_ERROR | 
    E_CORE_WARNING | 
    E_COMPILE_ERROR | 
    E_ERROR | 
    E_WARNING | 
    E_PARSE | 
    E_USER_ERROR | 
    E_USER_WARNING | 
    E_RECOVERABLE_ERROR 
);

But you should keep strict standard messages on, because in some cases they advance to real errors in later PHP versions, so it is better to fix them early.

share|improve this answer

To hide strict errors you could use the solution provided by RadGH here http://goo.gl/EaVkSr: just put the following code in a must use plugin (a single php file under /wp-content/mu-plugins/)

if (WP_DEBUG && WP_DEBUG_DISPLAY) 
{
   ini_set('error_reporting', E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.