How to Turn off WordPress PHP Errors

wordpress errors

WordPress users sometimes need to know how to turn off PHP errors in WordPress. PHP warnings and notifications can help developers debug code. However, when all website visitors can see it, it looks very unprofessional. This article will show how to easily close PHP errors in WordPress.

Why and when should I close WordPress PHP errors?

The PHP errors seen on sites are usually warnings and notifications. These are not like internal server errors, syntax errors, or fatal errors that prevent the website from loading.

Notifications and warnings are errors that will not prevent WordPress from loading your website.

PHP error on admin panel

The purpose of these errors is to help developers debug problems with their code. Plug-in and theme developers need this information to check compatibility and best practices. However, if you do not develop themes, plugins, or custom websites, then hide these errors. Because if they appear on the front end of a website to all visitors, it looks very unprofessional.

WordPress PHP errors

If the above error is seen on a website, notify the corresponding theme or plugin developer. They may release a fix to make the error go away. At the same time, you can also close these errors. Let’s see how to easily turn off PHP errors, notifications, and warnings in WordPress.

Turn off PHP errors in WordPress

For this part, the user will need to edit the wp-config.php file.

In the wp-config.php file, look for the following line:

1 define ('WP_DEBUG', true);

This line may also be set to false. In this case, you will see the following code:

1 define ('WP_DEBUG', false);

In either case, you replace these lines with the following code:

1 ini_set ('display_errors', 'Off');

2 ini_set ('error_reporting', E_ALL);

3 define ('WP_DEBUG', false);

4 define ('WP_DEBUG_DISPLAY', false);

Don’t forget to save changes and upload the wp-config.php file back to the server.

Now visit the website to confirm PHP errors, notifications, and warnings have disappeared from the website.

Error opening PHP in WordPress

If working on a local server or staging area website, open an error report. In this case, edit the wp-config.php file and replace the previously added code with the following code:

1 define ('WP_DEBUG', true);

2 define ('WP_DEBUG_DISPLAY', true);

This code will allow WordPress to start displaying PHP errors, warnings, and notifications again.

You May Also Like

About the Author: BW

Leave a Reply

Your email address will not be published. Required fields are marked *