×


Pluggable.php File Errors in WordPress – Fix it Now ?

Pluggable.php File Errors in WordPress happens when you have made an addition of code snippet to the WP website, activated a new plugin, or there is an incorrect coding in WP core files. The pluggable.php file error infamously is also termed as WordPress Error: Cannot Modify Header Information.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve related WordPress errors.

In this context, we shall look into it's causes and How to fix Pluggable.php File Errors in WordPress easily.


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. Often, the error would be fatal and make our site completely inaccessible.


How to resolve 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.


Methods to fix Pluggable.php File Errors in WordPress ?

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

This article covers methods to fix Pluggable.php File Errors in WordPress. Basically, this WordPress error triggers when we add a code snippet on our site or activate a new plugin.

This means that Pluggable.php file errors takes place as a result of a poorly coded theme or plugin. It could also be a result of code errors in your WP files. 


The first option when troubleshooting the Warning: cannot modify header information pluggable.php error is to manually edit the faulty file. You are already supplied with the necessary information to locate the problem in the error message (remember, it's the first file in the message). 

All you need to do is open up this file, either through an FTP client like FileZilla, or through File Manager.

Make sure to pay special attention to the starting and ending PHP tags. 

There should not be spaces before or after the <?php tag, as well as the ?> tag. 

Also, the last line of code should not be followed with a blank line or extra space.