Blogs

Turning off PHP Errors in WordPress

Turning off PHP Errors in WordPress

Forthis part, you will need to edit the wp-config.php file.

Inside your wp-config.php file, look for the following line:
define('WP_DEBUG', true);

It is also possible, that this line is already set to false. In that case, you’ll see the following code:
define('WP_DEBUG', false);

In either case, you need to replace this line with the following code:

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

Don’t forget to save your changes and upload your wp-config.php file back to the server.

You can now visit your website to confirm that the PHP errors, notices, and warnings have disappeared from your website.

Turning on PHP Errors in WordPress

If you are working on a website on local server or staging area, then you may want to turn on error reporting. In that case you need to edit your wp-config.php file and replace the code you added earlier with the following code:

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
This code will allow WordPress to start displaying PHP errors, warnings, and notices again.

We hope this article helped you learn how to turn off php errors in WordPress. You may also want to see our list of the most common WordPress errors and how to fix them.

Author

Faiz Alam

I'm Professional Web developer currently focusing on new product, ideas, markets differentiation and building strong revenue stream for the schools and organisations, e.g. Online School Management System etc. I believe in creating own destiny. I am a positive thinker and a firm enthusiast of the thought “Efforts are never wasted!”

Comment (1)

  1. Mark
    19/05/2021 Reply

    Thank you so much Faiz!
    This is very helpful content.

Leave a comment

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