How to Solve Pluggable.php File Errors of a WordPress Website
While managing a WordPress website, you may need to add any custom code to enhance its features. Most WordPress users are non-techie, and they don't check code on a local environment before using on their live site.
Such a mistake leads to the occurrence of an error. Seeing a pluggable.php file error is not so common yet many users notice it while making any kind of changes to their site's PHP code.
As we all know, WordPress is a PHP-based Content Management System (CMS) and all of its themes and plugins use PHP as the coding language. Whenever a plugin or theme conflicts, an error occurs, and sometimes it leads to the pluggable.php file error.
Have you seen such an error on your site? Are you still trying to figure out the reasons and solutions? If so, this tutorial is for you.
The main reason for the happening a pluggable.php file error is when a new function isn't able to handle the override of the default WordPress functions.
The pluggable.php is one of the core WordPress files, which means there is something else which is conflicting the natural behavior of this file.
How does pluggable.php File Error Look Like and How to Fix it?
Most of the time, the error consists of a path from which it generates. As I mentioned above, pluggable.php is a core WordPress file and you shouldn't edit it.
So, you have to understand how the error looks like and what it reflects. Let me show you an example:
Warning: Cannot modify header information - headers already sent by (output started at /home/username/yoursite/wp-content/themes/themename/functions.php:1091) in /home/username/yoursite/wp-includes/pluggable.php on line 1280
There is a warning pointing out to line number 1280 in the pluggable.php file. Most people make this mistake and start editing this file.
If you look closely, there is another path which consists of the functions.php file of your WordPress theme. If you added any custom code snippet, you should check it again.
If you installed a new plugin which overrode the current function, try disabling it. It's possible that there is an extra space in the functions.php file.
Most probably, in the closing and ending PHP tags.
For example, you see an extra space in the ending tag like this: php ?>
Let me show you another example of the error.
Warning: Cannot modify header information - headers already sent by (output started at /home/username/yoursite/wp-content/plugins/plugin-name/plugin-file.php:1091) in /home/username/yoursite/wp-includes/pluggable.php on line 1280
If you check out the path mentioning line number 1091, it points out to a plugin, which means you should check the plugin which generates an error.
Not all plugins are well-coded. There are tons of third-party plugins available in the official WordPress plugin repository. And most times, when WordPress core updates, a plugin starts conflicting because of its old coding standards.
It's also possible that the plugin conflicts with any other plugins you use. Even though WordPress plugins are helpful, but sometimes they can be a big issue because of their poor-coded standard.
Where Can You Notice pluggable.php File Error?
I am sure; you're curious to know more about a pluggable.php file error. It's because every error has its location to display its warning message.
A pluggable.php file error can break down the site and you only see the warning message I mentioned above. Depending on the conflicts with the WordPress functions, you may be able to log in to admin dashboard and see the error.
Mostly when you copy and paste any custom code snippet without testing, it causes such a problem. So, it's always good to set up a local environment using XAMPP, WAMP, MAMP, or Local by Flywheel.
Just like the white screen of death, you can see a pluggable.php file error on every page of the site, which means whenever you try to open any page of the site, only a warning message appears.
How does an Error Message Look Like When it Happens Because of a WordPress Theme?
Though many theme developers have started to develop themes using React and other languages, the base remains on PHP because that's what WordPress functions works on.
Just like a plugin, a WordPress theme can also generate a pluggable.php file error. For example, similar to the first error I mentioned above, there may be another error on a different file.
Let me show you how.
Warning: Cannot modify header information - headers already sent by (output started at /home/username/yoursite/wp-content/themes/themename/admin-functions.php:1191) in /home/username/yoursite/wp-includes/pluggable.php on line 1240
As you can see, there is a path to line number 1191, but it's different than the usual warning message you get when you add a custom code snippet in the functions.php file.
It's because there is a different file now. You may be wondering that functions.php is the only file which has WordPress functions.
But you shouldn't ignore that every WordPress developer is different, and some might like to keep functions of a specific section in a different file, which acts as a functions.php file.
For example, functions controlling the built-in custom panel of a theme are present in the admin-functions.php file. So, the error message mentions this file.
What's the Best Way to Fix pluggable.php File error?
Whether it's occurring because of a WordPress theme, plugin, or custom code you copied and pasted, you should never edit files on the live site.
First and the most important step is to backup your WordPress website and its database using cPanel, FTP, or a plugin like UpdraftPlus.
If a theme or a plugin is the culprit, uninstall them and test on a local environment or any other demo site.
If the warning message displays an error path to a functions.php file where you recently added custom code, you should remove it, clear browser cache and try again.
Solving pluggable.php file error is quite easy if you understand the reason behind it. As I mentioned in this article, the main key to find a file which generates the error is checking out the path.
Forget about the path which points you out to the pluggable.php file because you shouldn't edit it. WordPress core files work fine, it's a plugin or theme which conflicts with the core.
I hope you can easily solve pluggable.php file error.