What is the pluggable.php file in WordPress? How do we solve his mistakes?

Some errors may occur in the WordPress system while using it for various reasons, and one of these errors is the pluggable.php file error, which often occurs when installing a plugin or template that is not compatible with the WordPress system, or when adding specific code to expand the functionality of WordPress without verifying the validity of this code. .

This would disrupt your access to the site’s control panel and make you lose the ability to control it, and this could be confusing, especially for beginners who do not have much technical experience in dealing with WordPress.

But there is no need to worry if you encounter this problem, because it is a simple problem and in this article you will learn how to solve it yourself after you know and understand the cause and location of the error.

We will explain to you what Pluggable.php file errors are, their causes, and how to locate them through the message shown on your site. We will also show you step-by-step ways to solve it through the hosting control panel if it prevents you from accessing your site. 

What is the pluggable.php file error in WordPress?

Most WordPress users expand the features of their websites and add new features to them, or add some functions that are not present in WordPress itself by activating some ready-made plugins or manually by adding programming codes that perform a specific function.

Therefore, the Pluggable.php file error appears when some code is copied without checking it, and then this code is included in one of the WordPress files with the aim of adding a feature or bypassing a basic function in WordPress, but the added code is unable to handle this function in the correct way. .

Or when a new plugin or template is activated on the site and it happens to be incompatible with the WordPress system you are using.

As is known, WordPress is a content management system (CMS) based primarily on the PHP programming language, and therefore all of its plugins and templates use the PHP language.

Therefore, when an add-on, template, or code conflicts with the basic code of this system, this may cause an error in the Pluggable.php file.

The file pluggable.php is one of the core files in the WordPress core system. It contains some basic WordPress functions that users and developers can override by writing their own code. 

WordPress allows users and plugins to go beyond these basic functions. But when these plugins or written codes conflict with the basic functionality then an error message (pluggable.php Error) appears on the screen as a path to the location where the error occurred.

The error message directs you to the location of the error so that you can deal with it and correct it, so you must read the content of the message carefully. The pluggable.php error message usually looks something like the following.

In the first line in the previous image you can find the following information:

 Warning: Invalid argument supplied for foreach () in /home/username/dempsite/wp-content/plugin/some-plugins/some-plugin.php on line 135

( username ) is the username on the hosting.

( dempsite ) is the name of the root folder of your WordPress site.

( some-plugin ) is the name of the plugin folder that caused the error.

( Line 135 ) is the line number that caused the error in the pluggable.php file.

Attention:  The pluggable.php file is an essential file in the main WordPress core and is responsible for organizing the work of all functions and tasks of the WordPress website. It is never recommended to try to modify it directly to resolve this error when an error message similar to the above appears. 


Reasons why the pluggable.php error appears and how to deal with it

We previously explained the general cause of the error in the pluggable.php file. In this paragraph, we will review for you in more detail how to find out the exact cause of the error in the pluggable.php file and explain the ways to deal with it.

It should be noted that sometimes, you may be able to continue working on your site’s control panel despite the appearance of this error, but most of the time you may not be able to access it.

The first reason: The error is due to a problem with the theme

In this case, the error message displayed on the site will show that the pluggable.php file error is caused by one of the files in the template folder installed on WordPress. For example, the following message shows that the pluggable.php file error is caused by the template file (function.php) , specifically On line number 1035.

Warning: Cannot modify header information – headers already sent by (output startedat/home/username/demosite/wp-content/themes/<span class=“has-inline-color has-vivid-red-color”><strong>mytheme/functions.php:1035</strong></span>) in/home/username/demosite/wp-includes/<strong>pluggable.php </strong>on line 1179

Note that this message includes the file name pluggable.php at the end, which is different from the usual warning message you receive if you add a custom code snippet in the functions.php file, which also contains Asayba functions in WordPress.

Read more about the functions.php file in WordPress, its importance, and how to edit it

Second reason: The error is due to a problem with one of the add-ons 

In this case, the error message shown on the site will show you a message containing the name of the add-on that caused the problem. For example the message will be similar to the following:

Warning: Cannot modify header information – headers already sent by (output startedat/home/username/demosite/wp-content/plugins/some-plugin-name/some-plugin.php:144) in /home/username/demosite/wp-includes/pluggable.php on line 1090

It appears in this previous message that the error is caused by the plugin file some-plugin.php located in the some-plugin-name folder inside the plugins folder on your site, specifically on line 144.

Third reason: The error is due to the presence of a space in the php code

Sometimes this message appears because there are extra spaces or spaces in the code of one of the plugin or template files, and it can be resolved by simply deleting these spaces. Sometimes the problem is bigger than that.

For this reason, we advise you in this case to go to the file shown in the message, and make sure that there are no spaces or spaces in this file before or after the opening and closing names <?php and ?< for the aforementioned software file. You must also make sure that there are no spaces after the last line of this file.

How do you solve Pluggable.php error problems?

It is recommended before starting to make any modifications or changes to WordPress files. Make a backup copy of the site . Then follow the following procedures:

1- Disable the plugin or template that caused the error

 Not all WordPress plugins or themes are properly coded. Especially those from third parties. Sometimes after updating WordPress, some old plugins may conflict with the modern version and cause the error to appear in the Pluggable.php file.

For this reason, this message appears after activating one of the plugins or directly after activating a new template. Then one of the possible solutions is to disable this plugin or template from your site, and inform the developer responsible for the specific file that caused this error.

For example, if we assume that the error message appears like this, then we understand that the cause of the problem is in the addition (elementor) in the file (elementor.php), specifically in line number 81.

Warning: Cannot modify header information – headers already sent by (

output startedat/home/username/demosite/wp-content/plugins/elementor/elementor.php:81)

 in /home/username/demosite/wp-includes/pluggable.php on line 1090

If you can access your site’s control panel, disable the Elementor add-on from there. If you are unable to do so, you must enter the hosting control panel, choose File Manager, and follow the following steps (the same steps can be followed whether the problem is caused by an add-on or a template):

1- Go to the File manager from the hosting control panel.

2- Open the folder (puplic.html).

3- Choose the folder (wp-content).

4- Open the Plugins folder or the Themes folder, as written in the error message.

5- Choose the add-on folder shown in the text of the error message, which in our example is the (Elementor) add-on.

6- Select the file found in the error message, which is here (elementor.php).

7- Delete the entire Elementor plugin folder from your site. 


2- Try to correct the code of the corrupted file causing the error (for developers)

This solution is only for developers or people who have sufficient technical experience to deal with WordPress codes. We always remind you that the best practice before modifying any code of a file in WordPress is to take a backup copy of this file and keep it with you before any modification.

If the error message appears in the Pluggable.php file after modifying one of the important files in WordPress and writing some code manually – or even after installing a specific template or plugin – and you have sufficient experience in dealing with WordPress files, then you can correct the file in question instead of deleting the plugin or template. Entirely from your site.

Access the file specified in the error message through an FTP client, inspect the code and check for an error and correct the error if you find it, or delete the entire file from the site and restore the original file before modifying it. 

It is also preferable to install a local copy of WordPress using a simulation program such as XAMPP to test any templates, add-ons, or fundamental code modifications on it instead of testing it directly on the live site. 


3- Delete the extra spaces, if any, in the file causing the error 

Sometimes the error in the code may be simple and result from the presence of extra spaces in the code file causing the error, as we mentioned previously. So make sure that there are no spaces before the beginning and end of the PHP tags. As we mentioned, there should be no space before and after the opening and closing tags of the file and after the last line of code in the file, as shown in the following images:

Note here that there is a blank line after the last line in the code that causes the error. Simply delete it to resolve the error. 

4- Make sure to test the codes on a demo site before using them on your live site

It is preferable, as a precaution, not to add any additional special codes from unverified sources to customize your live site before verifying them on a local test site (or a trial staging site ), and do not test them directly on your live site in order to avoid the appearance of an error page (Pluggable.php). Your actual site is down.

If you can figure out how to correct the faulty code before applying it, this is excellent, as you can then only correct the damaged code file, and apply the correct code to the actual site. Otherwise, check the source from which you took the code and report there a problem. 

The same applies to templates and plugins. It is also possible that it is programmed incorrectly or conflicts with other plugins you use on your site, so it is best to test it on a local environment and make sure it works correctly before activating it on your live site.

Conclusion

In this article, we learned about the reasons for the error in the pluggable.php file, which is one of the core WordPress files. We note that the occurrence of an error in it does not mean that the error is in the file itself, but rather it means that there is something new added to the site that conflicts with the normal behavior of this file and cannot handle overriding the default WordPress functions.

As we learned in this article, dealing with this error is not difficult or complicated, and it can be dealt with easily if you know its exact cause. All you have to do is determine the location of the error and the line number mentioned in the error message, and take the precautions we mentioned in this article to avoid this problem from occurring again.

Avatar photo
I am a young man who has been working in WordPress and e-marketing for 10 years. I would like to share my experience with you so that we can become professional in WordPress I will be happy to share the experience with you.