Do you want to turn off a PHP error in your WordPress website? PHP error is helpful for the developers to debug website errors and other issues. Developers can improve their website code by viewing the PHP error log. But it’s not a good practice to show the PHP error log to your users. So here in this article, we will guide you to turn off PHP errors in WordPress.
Why is it important to turn off PHP errors?
It is not a professional way to display your website error to your users. It will create a negative impact on your website. PHP errors are not similar to other common WordPress errors like a server error or syntax error. This type of error won’t restrict your website to load or any other features. PHP errors are like some warnings or notices.
Mainly PHP errors showed up to help the developer or website owner to analyze their website code to debug for issues or improvement. If you are a WordPress plugin or theme developer then you need this error log for compatibility. But for the other users of your website, you should hide this error as it looks unprofessional and your users may be confused to see the error message.
When you see any error notice in your website frontend then you can contact the author of that plugin or theme about the issue. You can also turn off these error notices to show on your website.
Turn off PHP error in WordPress
To turn off displaying PHP errors you need to customize your wp-config.php file. Open up your wp-config.php and look for the following code.
You can also see the condition as false. In that case, the code should look like this –
You need to replace this code with the following ones.
ini_set('error_reporting', E_ALL );
Save the file and all your PHP error notices will be hidden from your website. When you need to see the error notice or message then you can easily enable it. Again open up the wp-config.php file and replace the code you just added with the following –
This code will turn on the PHP error and you will be able to show the errors and notice.
Following the process, you will be able to turn off the PHP error in your WordPress website. You can see our other articles to learn How To Fix the “Failed To Load Resource” error In WordPress
We hope this article will help you. If you liked this article, please like our Facebook page to stay connected.