How to Turn Off PHP Errors in WordPress

The WordPress development environment has an easy-to-use debugging mode. It provides a warning message that indicates what file is the problem and what line it is located in.

Visitors, on the other hand, may find this unattractive and people can easily become discouraged by seeing this WordPress error message.

In this article, I’ll show you how to easily turn off PHP errors in WordPress.

If you need more help working out your WordPress Errors, you should also check my WordPress Error Logs Starter Guide.

PHP Error Messages: What Causes Them?

Most of the time, PHP file warnings occur due to outdated plugins or themes. The reason is that core files are frequently updated with WordPress updates, so some code becomes obsolete.

A theme or plugin can also generate PHP warnings when used with an incompatible component. There is a possibility that two current plugins that work well individually may not work well together. The reason for this is that everyone develops websites differently, hence there is no standard syntax for each web developer.

Fortunately, these warnings don’t necessarily indicate that the site is broken. It just looks ugly to a visitor who doesn’t expect it. An update may be created by the developer to remove the warning, but it isn’t always instantaneous.

Most of PHP errors are not dangerous for your website, but some of them might break or slow it. That’s why it’s important to monitor them with a plugin like WP Umbrella.

PHP warnings in WordPress look something like this: “/wp-content/plugins/pluginfile.php on line 238”

Basically, it just means a part of the file is incompatible with WordPress, the theme, or another plugin that you are using.

Until you are going to fix the coding yourself, it might be best to simply disabling the warning messages entirely

Turning off PHP Errors in WordPress

This part requires editing the wp-config.php file.

It would be wise to make a backup of your site before making any changes to the wp-config.php file. If anything goes wrong, you’ll have a quick way of restoring the site.

Look in your wp-config.php file for the following line:

define('WP_DEBUG', true);

Or

 define('WP_DEBUG', false);

It is necessary to replace this line with the following code in either case:

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

Save your changes, and then upload your wp-config.php file back to the server.

The PHP errors, notices, and warnings on your website should now be gone.

Thanks for reading this article on how to disable php errors, notices and warnings in WordPress, I hope it helped you!

You may also want to see my article on How to Fix Syntax Errors on WordPress.