How to disable PHP errors being displayed in WordPress

When WordPress PHP debugging is enabled – your website will display errors and warnings from the code to the users.

For example:

This is controlled through the WP_DEBUG constant.

To disable WP_DEBUG in WordPress, open your wp-config.php file:

And look for WP_DEBUG and make sure it is set to false.

For example:

define( 'WP_DEBUG', false );

When the WP_DEBUG constant is false, WordPress’ built-in debugging will not display any error messages or other debugging information on the front end of your site.

It’s important to note that this code only disables debugging for the front end of your site.

If you want to disable debugging for the back end you can add the following code to your wp-config.php file:

define( 'WP_DEBUG_DISPLAY', false );

This code tells WordPress to not display any error messages or other debugging information on the back end of your site.

When you do this, it is a good idea to enable WordPress’ built-in error-logging functionality – which will log any PHP errors or warnings to a log file instead of displaying them on the front-end or back-end of your site.

By default, the log file is located at /wp-content/debug.log.

define( 'WP_DEBUG_LOG', true );