Remove WordPress PHP Error Lines

Errors logs on your admin WordPress dashboard or site front-end? See now how to remove this WordPress PHP error lines form your site easily

Updated on July 25, 2022
Remove WordPress PHP Error Lines

If you are facing error lines on your WordPress related to PHP folders and other error logs on your admin, WordPress dashboard, or site front-end, see how to remove these WordPress PHP error lines from your site.

PHP warnings and notices help developers debug issues with their code. However, it looks incredibly unprofessional when they are visible to all your website visitors. This article will show you how to turn off debug errors in WordPress easily.

WordPress PHP Error Lines - how to remove
WordPress PHP Error Lines – How to remove them?

Why and When You Should Turn Off PHP Errors in WordPress?

Debug errors on your WordPress site are usually warnings and notices. These are not like internal server, syntax, or fatal errors that stop your website from loading. Notices and warnings are the kinds of errors that do not prevent WordPress from loading your website.

The purpose of these errors is to help developers debug issues with their code. Plugin and theme developers need this information to check for compatibility and best practices.

However, these errors should be hidden if you are not developing a theme, plugin, or custom website. Because if they appear on the front end of your website to all your visitors, it looks extremely unprofessional.

WordPress PHP Error Lines - how to remove
WordPress PHP Error Lines – How to remove them?

If you see an error on your site above, you may want to inform the respective theme or plugin developer. They may release a fix that would make the error go away. Meanwhile, you can also turn these errors off.

Let’s look at how to easily turn off debug errors, notices, and warnings in WordPress.

Remove WordPress PHP Error Lines

Error codes example on website
PHP error lines on WordPress dashboard – How to remove them?

Turning off Debug Errors in WordPress

For this part, you will need to edit the wp-config.php file on your public_html.

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

define('WP_DEBUG', true);

It is also possible that this line is already set to false. In that case, you’ll see the following code:

define('WP_DEBUG', false);

In either case, you need to replace this line with the following code to remove the PHP error lines on your WordPress:

ini_set('display_errors','Off');

ini_set('error_reporting', E_ALL );

define('WP_DEBUG', false);

define('WP_DEBUG_DISPLAY', false);

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

Moreover, you can now visit your website to confirm that the PHP errors, notices, and warnings have disappeared from your website.

Turning on Debug in WordPress

You may want to turn on error reporting if you are working on a website on the local server or staging area. In that case, you need to edit your wp-config.php file and replace the code you added earlier with the following code:

define('WP_DEBUG', true);

define('WP_DEBUG_DISPLAY', true);

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