WordPress Debug Log without Deprecated Notices

You turn on WordPress debugging only to find the log full of deprecated notices that make the log difficult to parse. Bummer.

You could spend time going through each deprecated notice and updating the offending piece of code. Or you could ask WordPress to ignore these deprecated notices (at least in the short term) by doing the following;

  • Open the file – /wp-includes/load.php
  • In the wp_debug_mode() function, find the line – error_reporting( E_ALL );
  • Replace this line with;
    //error_reporting( E_ALL );
    error_reporting(E_ALL ^(E_NOTICE|E_USER_NOTICE|E_DEPRECATED|E_USER_DEPRECATED));
    
  • Save.

This basically asks php to log everything but notices. There are a selection of other error levels to choose from – http://us1.php.net/manual/en/errorfunc.constants.php

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s