How To Turn Off PHP Errors In WordPress

How To Turn Off PHP Errors In WordPress

Last modified: May 7, 2020

FAQ
Cloudways

WordPress is a massively versatile platform for building a website and is great for developers. It does offer a simple to understand debugging system that issues warning messages about what file is at fault and where in the file there is a problem (the line of code). The problem is that non-developers can sometimes be dissuaded from using the system.

There is a simple way you can disable the warning message when debugging. This is a simple piece of code that just needs to be added to your website.

Show More

* This button will show the rest of the post and open up an offer from a vendor

What Causes PHP Error Messages

There are numerous reasons why you might get a PHP error message. However, the most common reason is that there is an outdated plugin or theme being used by your website. This will happen, more often than not, when there has been a massive update to the core WordPress programming and when the theme/plugin isn’t updated regularly enough.

Another option is that themes and plugins can sometimes conflict. Sometimes it is two plugins that are incompatible with each other. This is because most plugins have different developers and developers don’t always use the same syntax.

The warnings are not always present when the site is broken. They can just look very ugly, or off putting, to any visitor and this can lower conversion rates. A typical PHP error message will look like:

/wp-content/plugins/siteplugin.php on line 30

Developers can create an update to fix the warning, but it isn’t always a speedy resolution. But you could disable the warning yourself by following the steps below.

Step 1 – Backup Your Site

It’s always best if you backup your site before you make any changes. If you are changing the code, this process will protect you. You can use a backup plugin or copy all the WordPress website files using an FTP client and then backup your server database.

Step 2 – Access Your Website Via FTP

Assuming you used a plugin, then the next step should be to access your website using an FTP application, like FileZilla, to access the website files.

Step 3 – Find The wp-config.php File

Now you need to find the wp-config.php file. You should then right click and click on the ‘Edit’ option or download it into a text editor (not Word).

Step 4 – Find The Correct Line Of Code

Inside the document you need to find the line of code that says:

define(‘WP_DEBUG’, false);

You might notice that it says ‘true’ instead of ‘false’. This doesn’t matter. All you need to do is to replace this line with this:

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

Then all you need to do is save the document. If you downloaded the document onto your desktop and then made the changes, then you need to re-upload the document, replacing the original file.

Step 5 – Test

Now test your website to ensure that the error message isn’t displaying again and the site works.

Final Word

This small nugget is only one part in managing your WordPress website. Checkout our other FAQs to help you manage your website. And checkout our list of the best plugins and themes to give your website everything it needs to be a successful online presence.

Recap:
Save 4 Later
Email liked links to yourself