Wondering how to resolve ‘Pluggable.php File Errors in WordPress’? We will help you with that.
As a part of our Server Management Services, our Support Engineers helps to fix similar WordPress-related errors regularly.
Today, let us discuss the causes and fixes for this error.
Cause for Pluggable.php File Errors in WordPress
When we add a code snippet on our site or activate a new plugin, we may get the pluggable.php file error. Pluggable.php file contains some core WordPress functions that users and developers can override in their own code.
Basically, wordPress allow users and plugins to override certain core functions. These functions are located in the pluggable.php file.
If a WordPress plugin or a custom code snippet fails to correctly handle one of these functions, then we will see an error like this one:
Warning: Cannot modify header information – headers already sent by (output started at /home/username/demosite/wp-content/themes/mytheme/functions.php:1035) in /home/username/demosite/wp-includes/pluggable.php on line 1179
Sometimes, we would be able to continue working on our site despite the error. Sometimes, the error would be fatal and make our site completely inaccessible.
Solution for Pluggable.php File Errors in WordPress
The pluggable.php file is a core WordPress file. It is never a good idea to edit the core WordPress file as our first option, even when there is an error pointing to them.
Most likely than not, the error is coming from a different location.
In order to fix any error mentioning pluggable.php file, just look at the first location mentioned in the error.
Warning: Cannot modify header information – headers already sent by (output started at /home/username/demosite/wp-content/themes/mytheme/functions.php:1035) in /home/username/demosite/wp-includes/pluggable.php on line 1179
In the above example, the error is located in the theme’s functions.php file at line 1035.
This means we need to edit our theme’s functions.php file and change or remove the code causing this error.
Sometimes the headers already sent error is caused by an extra space after closing the php ?> tag. So we can just remove that and it will fix the issue.
Let us take a look at another example:
Warning: Cannot modify header information – headers already sent by (output started at /home/username/demosite/wp-content/plugins/some-plugin-name/some-plugin.php:144) in /home/username/demosite/wp-includes/pluggable.php on line 1090
This error message is pointing to a plugin on our WordPress site causing the error. We can simply deactivate the plugin and notify the plugin author about the error.
In almost all cases, errors mentioning pluggable.php file are not caused by the file itself.
These errors are usually caused by a custom code snippet we added to functions.php file or a poorly coded plugin or even our WordPress theme.
Simply removing or editing the code or deactivating the plugin will make the error go away.
Easy Ways to Prevent Errors in WordPress
There are a couple of ways to prevent common WordPress errors. They include:
1. Using the right tools
Using well-coded WordPress plugins and themes can save us all the trouble that comes with WordPress errors. Before selecting one, check for honest reviews and ratings. And check if it is compatible with our version of WordPress. Also, find out if it is regularly updated.
Another thing to be careful of is our WordPress host. Use one of the recommended WordPress hosts for our website.
2. Do not edit WP core files
Except we are a WordPress developer, we should avoid editing our WordPress files, even our theme and plugin files. This is because an error as little as misplaced letters and blank spaces could break our site.
3. Update themes, plugins and WordPress
A not updated website is vulnerable to attacks. Not just that, we may experience incompatibility which may result in pluggable.php file errors in WordPress.
Updating WordPress is easy. We will always get a notification on our WP dashboard when there is an update. Simply log in to our admin area and hit the ‘Update’ button.
4. Use a staging site
A staging site is an offline replica of our website. It is used primarily to test out new plugins, themes and features before using them on our live website.
We can use WP Staging plugin to create one for us. Before using new tools on our website, test them out on our staging site.
5. Backup our website
This does not prevent an error, but helps to restore our site in case we lose our site’s content.
[Need help to harden Nagios XI server? We’d be happy to assist]
Conclusion.
In short, this WordPress error triggers when we add a code snippet on our site or activate a new plugin.Today, we saw how our Support Engineers fix this error.
0 Comments