PHP error messages are important for developers to learn about issues on the website. So, it helps them resolve these issues immediately. However, these notifications show up for all website visitors over the web. This makes the WP website look very unprofessional.
Naturally, you don’t want that.
In this post, we help you learn how to turn off PHP errors in WordPress on your own to make it look good to visitors.
Should you turn off PHP errors in WordPress?
The first thing to know about these errors is that PHP error messages are alert notifications that warn developers and admins about some coding error in the website. A PHP error does not interfere with the loading of your website (unlike in the cases of fatal errors, syntax errors, and internal server errors, etc).
A warning message only helps website, theme and plugin developers learn about issues that they need to resolve using an appropriate code
So, if you’re developing a custom website, theme, or plugin, then you need these warnings to know about issues. Otherwise, it’s suggested to turn off PHP errors in your website so that your website doesn’t have to look unprofessional to your viewers.
In case you get notified about any of the PHP issues on your admin panel, contact the respective developer to fix that issue. However, turning these off for the front end is a smart step to take.
Here, we help you disable PHP errors and messages on your WP.
How to Turn Off PHP Errors in WordPress
You can do this task by accessing the wp-config.php file in your WordPress either via FTP or File Manager in your cPanel.
When you open the wp-config.php file, do the following:
In case, the code is set to false, you will see the following:
If you see this code, replace it with the following codes:
ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_DISPLAY', false);
Once done, save the changes
Now, upload the PHP file to the server again
After this, you need to access your website again to see if the PHP errors and messages are gone from the front end of your website.
This is how you can disable PHP error in WordPress and make sure your site looks professional and well-built. In case you make custom changes to your WordPress keep track of all alert notifications and warnings to ensure there’s no delay in any resolution to bugs and issues.