PHP errors, warnings, and notices have their use – to help you deduct what the problem is, obviously. Then, you’ll know exactly whether it was a wrong syntax, or you need to install a WordPress plugin or even delete an entire theme in WordPress and start anew. Two great examples of that are WordPress white screen of death and the “This site is experiencing technical difficulties” error. Now that you realize its importance, it’s also evident that you don’t need its help all the time. Luckily, there’s a way to enable or disable the feature at will. Here’s how to turn off PHP errors in WordPress.
The easiest way to disable PHP errors
You’ll need to access your WordPress files via FTP. To do this, you have two options. Both yield identical results, so you’re free to choose.
- Download and install an FTP client software.
Then, use the login details provided by your hosting (hostname or IP address, password, port, protocol) to access the root folder. - Log in to your cPanel on your hosting website.
Look for an option called FTP, File Manager, or Files.
Then, do this:
- Find your WordPress website’s root folder.
It might also be called www, public_html, or have your domain name. - Find a file named wp-config.php.
- Find the Edit option somewhere in the cPanel or FTP client.
- The file will open like any other text file.
- Press Ctrl (Control) + F on your keyboard.
- Search for ‘wp-debug.’
- Since PHP errors are enabled, you should find a line like this:
define(‘WP_DEBUG’, true);
Tip: You’ll know you’re in the right place because there will be a line /* That’s all, stop editing! Happy blogging. */ below. - Simply change true to false, so that it looks like this:
define(‘WP_DEBUG’, false); - Find the Save or Save Changes option in your software or the cPanel and press it.
- Refresh your website’s homepage, or the page you noticed errors on.
- Fixed? Great job!
What if it doesn’t work?
If this didn’t fix the issue, do this.
- Go back to the same line.
- Then, highlight the line and replace it with this:
ini_set(‘display_errors’, 0);
ini_set(‘error_reporting’, E_ALL );
define(‘WP_DEBUG’, false);
define(‘WP_DEBUG_DISPLAY’, false); - Once again, Save Changes.
- The PHP errors shouldn’t be there anymore.
That’s it! Making PHP errors disappear from WordPress wasn’t so hard, was it? If you need to enable them in the future, install a developer addon such as Query Monitor, for example.