Another annoying error that you might come across on WordPress is the pluggable.php error. This error occurs when you add a code snippet on your site or activate a new plugin.
In this article, you’ll learn how to fix pluggable.php file errors in WordPress.
Sometimes your site will work fine but the error will appear in the admin area.
Now that you know how the error looks like, let’s move further and see why and when this error occurs and how to fix it.
When and Why do you see pluggable.php errors?
WordPress allows plugins and users to override certain core functions. These functions that override the core functions are located in pluggable.php file. If a WordPress custom code snippet or plugin fails to correctly handle one of these functions, then a pluggable.php error occurs as seen above.
How to Fix Pluggable.php File Errors in WordPress?
Before you go ahead with how to fix pluggable.php file error in WordPress, know that it is not a good idea to edit a core WordPress file. Even if there is an error pointing to them.
Most likely, the error is coming from a different location.
To fix the error that is 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 1213
In the above example of pluggable.php error, you can see that error is located in the theme’s function.php file at line 1213.
You’ll have to edit your theme’s functions.php file and change or remove the code causing this error.
It is possible that the headers already sent error is caused by an extra space after closing the php ?> tag, you just need to remove it and the issue will get fixed.
Sometimes the error might be caused due to a plugin. You simply need to deactivate the plugin and notify the plugin author about the error.
In most of the cases, errors mentioning pluggable.php file are not caused by the file itself, they’re caused by custom code snippets you add to functions.php file. Poorly coded themes and plugins also cause this issue.
The above methods should fix the pluggable.php file errors in WordPress. If you know any other methods, feel free to share with us in the comment section.