Are you trying to turn off warnings or PHP errors in WordPress? Such warnings and errors are unappealing and can also turn away visitors, so it’s important to learn how to hide them.
In this guide, we’ll explain you how to hide warnings and disable PHP errors in WordPress.
Troubleshooting warnings and PHP errors in WordPress
👉 Don’t forget to check out our WordPress Error Logs Starter Guide for more in-depth troubleshooting tips.
Understanding PHP Errors and Warnings in WordPress
PHP errors and warnings are messages generated by the server and giving information about an issue in the PHP code of your WordPress website.
PHP errors usually point to a more serious issue, like a critical problem in your code that could break your website.
Warnings are more like a friendly nudge; they alert you to potential problems but don’t stop the script from running.
These messages can be invaluable for developers during debugging. If you want to learn more about PHP errors, the official documentation of PHP is a must have.
PHP Error Messages: What Causes Them?
Most of the time, PHP 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 or deprecated.
Incompatibility between plugins or between a plugin and your active theme can also be responsible for the error. The lack of a standardized coding syntax among developers and plugin editors adds to this complexity.
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.
They usually don’t mean your website is broken, but they can make it look unprofessional. Monitoring them with a plugin like WP Umbrella can help you catch issues before they escalate.
Monitor PHP errors & warnings with WP Umbrella
Install WP Umbrella on your websites in a minute and discover a new way to manage multiple WordPress sites.Get Started for free
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 fix the coding yourself, it might be best to simply disable the warning messages entirely.
How to Hide Warnings and Disable PHP Errors in WordPress
This part requires editing the wp-config.php file. Before diving into the technical part, ensure you backup your website. A backup will provide you with a safety net in case things go south.
Step 1. Open Your wp-config.php File
Look in your wp-config.php file for the following line:
Step 2. Replace the Debug Lines
Replace the existing lines with the following code snippet:
ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_DISPLAY', false);
Step 3. Save and Upload
Save your changes and re-upload your
wp-config.php file back to your web server. You should no longer see PHP errors, notices, or warnings on your website.
Need Additional Help With Errors and Warnings?
If you encounter any issues or have more questions, you can always contact the plugin’s developer or seek advice in the WordPress support forums.
You can also rename your plugins folder via FTP to something like
plugins_debug for further testing.
Remember to keep your WordPress plugins, themes, and core up-to-date. Also, make sure you’re running the latest version of PHP to avoid any compatibility issues.