1
votes

I have an old Wordpress site running under PHP 5.4 which is throwing a lot of minor error notices such as undefined index.

I'm not able to fix these - the errors are coming from a bunch of 3rd party plugins on a site that I did not develop and don't have the time to fix.

The quick fix for the moment is to hide the error notices. Adding this to wp-config.php hides errors from the screen, writing them to the debug.log file:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

I'd like to decrease the verbosity of the errors in the log file by using something like:

error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);

I read the only way to do this is by creating a custom must-use plugin (mu-plugin).

Is this still the current/best technique to do this (as of Wordpress 4.2.2)? (without using a 3rd party debug tool).

Does anyone have a sample of this type of plugin for reference? I'm finding it difficult to locate information on this.

1

1 Answers

0
votes

you can change on wp-config.php file replace this code .

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

replace with

define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);

now your error message hide.