How to Turn Off PHP Errors in WordPress


PHP errors the codes which are used by the developers to diagnose and fix the issue. These codes are due to some issues with theme and plugins. There is nothing to worry but it looks unprofessional when visitors visit your website. These are notices and warnings which are sometimes visible on the website front end. These codes help developers to know about the actual issues so that they can fix using the warning or codes. These codes never stop your website to load. Developers need this information to check the compatibility and for testing purpose.

For developers, it is necessary to hide this codes or warnings from the front-end because it looks extremely unprofessional when people visit your website. It makes a negative impact on the visitors and can also reduce your website traffic.

So these PHP codes should be hidden on the front end and will be visible only to the developers so that they can use these codes to debug the issue and fix them.
 

 
The above screenshot shows PHP errors on the front end. You may have to inform respective plugin developer about the issue and they should fix the issue.

In this article, we will show how we can disable PHP errors in WordPress using a simple method.
 

Turn Off PHP Errors in WordPress

Step (1) – Go to your FTP and locate the wp-config.php file. Open the file in any editor.
 

 
Step (2) – Inside the wp-config.php file, look for the either codes:
 

define('WP_DEBUG', true);
Or
define('WP_DEBUG', false);

 
Step (3) – In either case, replace the 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);

 
Step (4) – Save the file and upload it back to the server in the same location.

Step (5) – Visit your website front end to confirm that the warning or codes are disappeared from website.
 

Turn on PHP Errors in WordPress

If you are using WordPress for testing purpose, you can enable the errors to know the issues. You have to replace the code which you added earlier with the following code:
 

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

 
This code will allow errors or warnings to display on the front end. We hope this article will be useful to you.

You can also check how we can Create Child Theme in WordPress.

Spread the love

Kapil Garg

Kapil Garg has 7 years of experience in building professional websites. He is a leading web developer, web designer and Google adwords certified partner. His passion is to designed and developed most impressive websites.

2 thoughts on “How to Turn Off PHP Errors in WordPress

Leave a Reply

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