Are you trying to turn off PHP errors in WordPress?
The WordPress development environment has an easy-to-use debugging mode. It provides a warning message that indicates what file is the problem and what line it is located in.
Visitors, on the other hand, may find this unattractive and people can easily become discouraged by seeing this WordPress error message.
In this article, I’ll show you how to easily turn off PHP errors in WordPress.
If you need more help working out your WordPress Errors, you should also check my WordPress Error Logs Starter Guide.
Most of the time, PHP file 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.
A theme or plugin can also generate PHP warnings when used with an incompatible component. There is a possibility that two current plugins that work well individually may not work well together. The reason for this is that everyone develops websites differently, hence there is no standard syntax for each web developer.
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.
Most PHP errors are not dangerous for your website, but some of them might break or slow it. That’s why it’s important to monitor them with a plugin like WP Umbrella.
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.
This part requires editing the wp-config.php file.
It would be wise to make a backup of your site before making any changes to the wp-config.php file. If anything goes wrong, you’ll have a quick way of restoring the site.
Look in your wp-config.php file for the following line:
define('WP_DEBUG', true);
Or
define('WP_DEBUG', false);
It is necessary to replace this line with the following code in either case:
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
Save your changes, and then upload your wp-config.php file back to the server.
The PHP errors, notices, and warnings on your website should now be gone.
Thanks for reading this article on how to disable PHP errors, notices and warnings in WordPress, I hope it helped you!
A step-by-step guide to troubleshoot WordPress syntax errors.
WordPress error logs started guide: All what you should know to set up and access WordPress error logs.
Everything you need to know about the PHP memory limit in WordPress and how to easily increase it to fix the allow memory size exhausted error.