Web Hosting

How to Turn Off PHP Error Notifications on WordPress?3 min read

PHP error notifications are used to debug issues in coding by the developers. It is important for the theme or plugin developer to know about these errors so they can fix in future release. Some of these also help developers to ensure compatibility with older WordPress versions and PHP versions.

Are you looking for the lightest multipurpose WordPress theme? Here’s why you should choose BeTheme.

But it looks very unprofessional when visitors see it on your website. From time to time, many readers have asked us how to turn PHP error messages off in WordPress. In this post, we are going to show you how to turn off these errors on WordPress.

Should You Turn off PHP Errors on WordPress Now? Why?

PHP errors you come across on your WordPress are mostly notices and warnings. Unlike syntax errors, internal server error, or fatal errors, these notices don’t stop your site from loading. It means your webpage can load just as usual but with some error messages on the top or at any area of the page.

The aim of these errors is to help developers debug the errors with code. Theme and plugin developers require this info to check for best practices and compatibility. These errors should be hidden if you are not going to develop a plugin, theme or a custom website. It looks totally unprofessional as it mostly appears on the front of the website.

If you see any error on the top of your site, you may want to contact the respective plugin or theme developer. They may fix the bug on next update and it would remove the error. At the same time, you can easily turn off these errors. Here are the ways to turn off PHP notices, errors, and warnings on your WordPress site.

Looking for the best plugin to customize your site? Here are top background and video gallery plugins.

Steps to Turn off PHP Errors in WordPress

This way, you will want to edit wp-config.php file. Watch out for this line in your wp-config.php file –

define(‘WP_DEBUG’, true);

There are also chances that this line is set to false already. Here, you will see this code –

define(‘WP_DEBUG’, false);

In any of these cases, you will want to replace it with this code –

ini_set(‘display_errors’,’Off’);

ini_set(‘error_reporting’, E_ALL );

define(‘WP_DEBUG’, false);

define(‘WP_DEBUG_DISPLAY’, false);

Be sure to save changes and upload wp-config.php file back to server. Now, you may visit your site to confirm that notices, PHP errors, and warnings removed from the website.

How to Turn on PHP Errors?

If you are working on a staging area or local server on a website, you may need to turn error reporting on. Here, you have to edit wp-config.php file and replace the above code with this code –

define(‘WP_DEBUG’, true);

define(‘WP_DEBUG_DISPLAY’, true);

WordPress displays PHP warnings, errors, and notices with this code. We hope you’ve liked this article and learned how to turn php errors off in WordPress. You may also see our SEO tips to be featured on Google Answer Box.

 

(Visited 2 times, 1 visits today)

Leave a Reply