How to Turn Off PHP Errors in WordPress

PHP warnings and notices help developers debug issues with their code. However, it looks extremely unprofessional when they are visible to all your website visitors.

In this article, we will show you how to easily turn off PHP errors in WordPress.

Disclosure: I may receive affiliate compensation for some of the links below at no cost to you if you decide to purchase a paid plan. You can read our affiliate disclosure in our privacy policy.

Turning off PHP Errors in WordPress

define('WP_DEBUG', false);
By GloriousThemes

The above code is simple and works for most WordPress websites.

But for some reason, some websites still display the error, this happens due to the PHP settings in your Hosting.

But you don’t need to worry, as I won’t suggest you go and edit the PHP settings if you don’t know what you are doing.

So, If your Error is still displayed then copy the below code and paste it into your config.php

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

This code will turn off all your PHP errors in your WordPress from both ends( backend and frontend).

Turning on PHP Errors in WordPress

define('WP_DEBUG', true);
By GloriousThemes

If you want to log the errors in a file and will start displaying PHP errors, warnings, and notices again.

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

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *