WordPress has a built-in method and regular PHP functions for debugging that helps the developers to solve issues. These built-in methods offer warning message which pops up with details like what file is causing the issue and what should you do. And these messages look unprofessional and it affects users to visit the website. In this article, we will talk about how to turn off WordPress PHP error.
Causes Of WordPress PHP Error
These PHP errors on the WordPress site are the warning messages and notices. And these messages are different from internal server error, and other fatal errors that affect the loading of the website.
- Most of the time warning or error in the PHP files occur due to outdated plugins or themes used in the website.
- Themes and plugins can also show the PHP messages when they are operated with something that is incompatible. These notices and warnings do not stop WordPress from loading and managing the website.
- These errors also occur when two plugins which work independently well and have issues when paired together. This is due to the different working of the developer; every developer doesn’t use the same syntax for developing the website files.
These warnings are common and it doesn’t mean the site is broken. But this just looks unprofessional for the visitor. The purpose of these errors’ messages is to help the developers to debug the issues. Developers regularly create an update to fix the warning. But sometimes it is not always quick.
PHP warnings in WordPress look like:
“/wp-content/plugins/siteplugin.php on line 30”
And this doesn’t mean the plugin is bad, it can be due to the incompatibility with WordPress, or any other plugin.
Disabling PHP Errors In WordPress
In this, you have to edit the wp-config.php file of WordPress. But you should create a backup of the website before making any changes in coding to protect the data of the website.
There are lots of methods to access the wp-config.php file of WordPress.
Let’s do it using the file manager in cPanel.
- Go to cPanel and click on the file manager.
- Click on the “public_html” in the directory to access the website.
- Select the wp-config.php and click the “Edit” button located on the toolbar.
- Then a new window will pop up, just click on the Edit button and you will find the code.
Search for define (‘WP_DEBUG’, false); and replace it with:
ini_set (‘error_reporting’, E_ALL);
define (‘WP_DEBUG’, false);
define (‘WP_DEBUG_DISPLAY’, false);
Save all the changes and upload the file back to the server to see if the error is solved or not. You can also check the website PHP errors have disappeared from the website or not.
Enabling Php Errors In WordPress
If you are Working on the local server, they will need to turn on the error reporting and for that, you have to the following:
Edit the config.php file and replace the code that you added on the above section for disabling with:
define (‘WP_DEBUG’, true);
define (‘WP_DEBUG_DISPLAY’, true);
It will again allow the website to start displaying the PHP errors and warnings.
Plugin To See Php Error Logs
Plugins like QUERY MONITOR are used for detailed analysis to see the PHP error logs on the live site.
It gives a detailed analysis of PHP errors with every detail. And with this plugin, you directly fix the error and make the website error-free.
We hope this article helped you with how to turn off WordPress PHP errors. If you have any query then you can comment on the section given below for assistance from our expert.