How to Solve Pluggable.php Errors in WordPress
WordPress sometimes throws errors at you for simple reasons. The pluggable.php file error in WordPress is one of such. If you are receiving it at the moment, it’s nothing to worry about.
In this article, we’ll let you into what the error looks like, its causes, and most importantly, how to fix it.
Content:
- What does pluggable.php file error look like?
- Why am I receiving the pluggable.php error?
- How to fix pluggable.php file errors?
- Easy ways to prevent errors in WordPress
- Conclusion
What Does Pluggable.php File Error Look Like
You’ve got a pluggable.php file problem in your hands if the error message you are getting is similar to this:
Warning: Cannot modify header information – headers already sent by (output started at /home/name/yourwebsite/wp-content/plugins/nameofplugin/plugin-file.php:109) in /home/name/yoursite/wp-includes/pluggable.php on line 1210’
The example above is likely to be slightly different from yours. name would be the username of your hosting account and yourwebsite would be the folder name where your WordPress site is stored.
As you can see, the warning message already gives a clue on the cause of the error. It displays the path where the error occurred.
In this example, plugin-file.php within my plugin’s folder is the document that needs fixing and the error is on line 109. Note that the name of the plugin will be stated.
Instead of pointing to a plugin, the error message may also point towards a theme you just added to your website. In that case, you’ll receive a message similar to this:
‘Cannot modify header information – headers already sent by (output started at /home/name/yourwebsite/wp-content/themes/nameoftheme/theme-file.php:109) in /home/name/yoursite/wp-includes/pluggable.php on line 1210’
Why Am I Receiving the Pluggable.php Error?
WordPress comes with a file called ‘pluggable.php’. It is located within the wp-includes WordPress directory.
The file contains core WordPress functions that a WordPress admin can override.
Some of the pluggable functions are:
- wp_mail – This is a function used for sending emails. You can modify this to customize your WP email template.
- wp_new_user_notification – This function is used for sending an email right after a new user gets registered.
- auth_redirect – It checks if a user is already logged into the WordPress website and redirects him if he isn’t.
- wp_password_change_notification – This function sends an email when there is a password change.
There are a couple of other functions in the pluggable.php file – each one has its purpose.
For the sake of customization, you can override or modify any of the functions.
Now, when a user tries to override a function with a plugin or a code snippet, an error may occur. It’s called the pluggable.php file error.
The error occurs primarily because the plugin or code snippet is unable to override the WP pluggable function properly.
How to Fix Pluggable.php File Errors?
Let’s make this clear – Never edit your Pluggable.php file. It is a WordPress core file and a little mistake can break your site.
Although it is referred to as a pluggable.php file error, the fault isn’t from the file itself.
To fix the error, take a closer look at the error message displayed on your screen. It already specifies where the fault is.
Let’s see an example. If this is the error you are receiving:
‘Cannot modify header information – headers already sent by (output started at /home/name/yourwebsite/wp-content/themes/nameoftheme/functions.php:128) in /home/name/yoursite/wp-includes/pluggable.php on line 1210’ (in case of a theme)
1. Analyse the message
Here’s the first step.
From the message above, we can tell that the problem is from line 128 in the themes’ function.php file.
Since it’s a theme issue, the next thing to do is either deactivate the theme or locate the line of code where the error emanates from and fix it. Read our How to Fix WordPress Syntax Error article to learn how to fix code errors.
If the error notification specifies a problem with a plugin, like this:
Warning: Cannot modify header information – headers already sent by (output started at /home/username/yourwebsite/wp-content/plugins/nameofplugin/plugin.php:134) in /home/username/examplewebsite/wp-includes/pluggable.php on line 1123
Do the same thing. Check which WordPress plugin is giving trouble. Then, deactivate the plugin or fix the code.
2. Deactivate theme to fix pluggable.php file errors in WordPress
If the error was caused by a theme, the next thing to do is deactivate it. To do this, log in to your WP dashboard. Hover your cursor over Appearance and click on Themes. The next screen that pops up displays all the themes you have installed on your website.
To deactivate the active theme, simply activate a default WordPress theme (say TwentyTwenty) or any other theme.
If you do not have access to your dashboard, you can deactivate your theme via FTP.
To do this, download and install an FTP client (like FileZilla). And then launch it.
When open, go to ‘File >> Site Manager’.
Fill in your site’s login credentials (these are often the same as your cPanel login details, but you can ask your web host for this information if you do not know it). Next, click ‘Connect’.
After connection, you’ll see your remote site files by the right side of your screen.
Now, locate the folder containing your WordPress site files (it’s usually the public_html). Double click to open the folder.
Next, find the wp-content folder and double-click to open it.
Now, open the themes folder and locate the theme you want to deactivate.
Right-click on the theme you want to disable, then select Rename from the list of options that comes up.
Rename the theme by adding _deactivate to the name of the theme.
This action automatically disables that theme. Reload your website to see if the error has been fixed.
3. Deactivate plugins to fix pluggable.php file errors in WordPress
If the error came as a result of a plugin you just installed, try deactivating it.
If you still have access to your WP dashboard simply go to ‘Plugins >> Installed Plugins’. Then, navigate to the specific plugin causing the error and click ‘Deactivate’.
Refresh your site and the error should be gone.
But, if you do not have access to your WP dashboard. Here’s how to deactivate the trouble-causing plugin via FTP.
To start, connect to your site via FTP. The steps to connect are the same as we’ve explained above in the disable theme section.
After a successful connection, locate and open the public_html folder (if your site files are in a different folder, locate that instead).
Within this folder, locate the wp-content folder and double click to open it. Now search for the plugins folder and open it to reveal your individual plugin folders.
Next, scan through the folders to find the one named in the error message.
Once found, right click on it, select Rename, and change the name of the folder by adding ‘_deactivate’ to it.
Lastly, reload your site to see if the error has been resolved.
You may report the issues faced with the plugin to the developers for it to be fixed. Or, you can find an alternative plugin.
4. Fix pluggable.php file errors in WordPress by checking custom code
It is quite easy to add a custom code snippet to your WP files. These codes help to enhance your WordPress site’s functionality. If you know how to add codes in WordPress, you can achieve a lot more with your website.
While this is good, pluggable.php file errors sometimes arise as a result of a custom code you added. This happens mostly when the code snippets are from an unverified source.
The error may look similar to this:
Warning: Cannot modify header information – headers already sent by (output started at /home/name/sample-site/public_html/wp-config.php: 5) in /home/name/sample-site/public_html/wp-includes/pluggable.php on line 120
How to fix it
To undo this error, launch your FTP client, enter your login details, and access your root directory. Next, locate the file identified as the error source (in this case wp-config.php) and right-click on it, and select ‘Download’ from the list of options that appears on your screen.
After download, open the file on your computer with the aid of a text editor (NotePad++ is a great one). Then, check the file.
Thankfully, you do not need to check each line for the error. The error message already states the line where the error can be found. Sometimes it could be an extra space after the closing PHP tags. Although it seems insignificant, it could be the cause of the error. Remove them and get your codes running again.
Note: The line shown in the error may not be the exact line the error occurs. In some cases, it could be a few lines above or below. Please read our Syntax Error Troubleshooting Guide for more info.
After carefully editing the file, save it.
Next, upload it back to the folder you downloaded it from using the FTP client. When you upload it, you will be prompted to overwrite the previous file on the server. Hit Yes.
Now, reload your site to see if the error has been fixed.
Side Note: Before editing any WordPress core file, ensure that you have a full and recent backup of your website.
5. Meet the experts
Fixing pluggable.php errors usually involves editing code or disabling conflicting plugins. To avoid these issues in the future, our WordPress support and maintenance services offer ongoing monitoring and troubleshooting to prevent these errors from reoccurring.
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 you all the trouble that comes with WordPress errors. Before selecting one, check for honest reviews and ratings. And check if it’s compatible with your version of WordPress. Also, find out if it is regularly updated.
Another thing to be careful of is your WordPress host. Use one of the recommended WordPress hosts for your website.
2. Don’t edit your WP core files
Except you are a WordPress developer, you should avoid editing your WordPress files, even your theme and plugin files. This is because an error as little as misplaced letters and blank spaces could break your site.
3. Update themes, plugins, and WordPress
An un-updated website is vulnerable to attacks. Not just that, you may experience incompatibility which may result in pluggable.php file errors in WordPress.
Thankfully, updating WordPress is easy. You’ll always get a notification on your WP dashboard when there’s an update. Simply log in to your admin area and hit the ‘Update’ button.
4. Use a staging site
A staging site is an offline replica of your website. It is used primarily to test out new plugins, themes, and features before using them on your live website.
You can use WP Staging plugin to create one for yourself. Before using new tools on your website, test them out on your staging site.
5. Backup your website
This doesn’t prevent an error but helps you restore your site in case you lose your site’s content.
There are a couple of WordPress plugins that can help you backup your site effectively. See this guide on how to perform regular WordPress backups, to know more.
Frequently Asked Questions
What are pluggable PHP errors in WordPress?
Pluggable PHP errors in WordPress occur when a custom function or plugin tries to redefine a function that has already been defined in the pluggable.php file. These errors can lead to website crashes, broken functionality, or other issues.
What causes pluggable PHP errors in WordPress?
Pluggable PHP errors are typically caused by conflicts between plugins, themes, or custom code snippets. They occur when multiple functions with the same name are defined, resulting in a conflict that generates an error.
How can I fix pluggable PHP errors in WordPress?
To fix pluggable PHP errors, you can follow these steps:
- Identify the conflicting function name from the error message.
- Deactivate the problematic plugin or theme.
- Locate the file containing the conflicting function in the plugin or theme folder.
- Modify the custom function to avoid conflicts, or contact the plugin or theme developer for assistance.
Can I prevent pluggable PHP errors in the future?
Yes, you can prevent pluggable PHP errors by following best practices, such as:
- Keeping your WordPress installation, plugins, and themes updated.
- Using well-coded and reliable plugins and themes.
- Testing new plugins and themes in a staging environment before implementing them on your live site.
- Avoiding modifications to core WordPress files.
Are pluggable PHP errors common in WordPress?
Pluggable PHP errors are not very common, but they can occur when using custom code or poorly coded plugins and themes. By following best practices and ensuring compatibility between your installed plugins and themes, you can minimize the chances of encountering pluggable PHP errors.
How do I know if a plugin or theme is causing the pluggable PHP error?
To identify the problematic plugin or theme, you can follow these steps:
- Deactivate all plugins and switch to a default WordPress theme.
- Reactivate each plugin one by one, checking for errors after each activation.
- If the error reoccurs after activating a specific plugin or theme, that’s the likely source of the conflict.
Conclusion
Pluggable.php file errors occur as a result of a poorly coded theme or plugin. It could also be a result of code errors in your WP files. Now, you know how to fix it.
Other WordPress errors you may encounter in WordPress include: ‘error establishing database connection in WordPress’, ‘403 error’, ‘Site is experiencing technical difficulties’, etc.
To learn how to fix the errors and for more WordPress tutorials, check out our WP blog.
Technology vector created by stories – www.freepik.com