One of the WordPress capabilities for developers is PHP errors. It allows you to see errors in your coding. Perhaps at a glance, it seems to be a good feature, but the problem here is that the errors are visible to website visitors and we do not want that to be the case. In this article, let’s teach you How to hide PHP errors in WordPress.
Why and when should we hide PHP errors in WordPress?
PHP errors that you can see on your website are often warnings and notifications. When you say error, you should not be the same with the internal server error or other fatal ones. Notices will not put your site in any way inaccessible or damaged. The main purpose of these alerts is to help programmers to resolve code issues. Developers need this information to match their code with different standards and browsers. You may see errors like the below image in the WordPress dashboard.
Even in some cases, PHP errors are also seen in the front end of your site.
If you see a warning like the image above on your site, it’s better to let your website developer know what to do. You can also stop the display of alerts.
Disable and hide PHP errors in WordPress
We need to change the wp-config.php file to stop the error display. After you open this file in the host manager, find the following code. you can reach the file with CPanel or FileZilla.
It’s likely that your site code value will be the false and see the code as follows.
Whichever is the case above, you must delete it and place the following code instead.
ini_set(‘error_reporting’, E_ALL );
Do not forget to save it after making changes. Now you can go back to your website and see if the errors are no longer displayed.
Enable display of PHP errors in WordPress
If you decide to re-enable PHP errors for any reason, it’s easy to do. Just open the wp-config.php file again and replace the code in the previous section with the following code.
Comment on How to hide PHP errors in WordPress if you know better method and make us feel better.