How to turn off error reporting in WordPress

Using WP-Config.php to control error reporting in WordPress

interwebing02 News

Are you seeing PHP errors or warnings on the front-end of your WordPress website? Here is a very simple method for turning that off. First you need to find your ‘wp-config.php’ file. We typically login via SFTP to handle this, but there are plugins that will allow you to modify your core files. Within your ‘wp-config.php’ file search for the following line of code:

define('WP_DEBUG', true);

This line may already be set to false, in which case it would look like this:

define('WP_DEBUG', false);

NOTE: It is also possible that you do not have ‘WP_DEBUG’ in your ‘wp-config.php’ file at all.

Regardless of how your current file is setup, you need to add/modify the following four lines of code in your ‘wp-config.php.’

ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

Save the file and check the front-end of your website. You should no longer be seeing any PHP errors or warnings. If you would like to turn error reporting back on, replace the above four lines of code with these two lines of code:

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

Don’t forget to save the file and check the front-end to ensure your changes are functioning as expected.