How To Fix Warning: Cannot Modify Header Information Error In WordPress!

As a blogger and writer, we face lots of problems in the journey of a successful blog. Whether it’s a technical problem or any other problems related to blogging, It needs to be fixed for providing the best and most useful content to your audience.

How To Fix Warning: Cannot Modify Header Information Error In WordPress

Today we are going to learn about one of those WordPress related problems, Known as “Warning Can not Modify Header Information” or “Pluggable.php error”. This warning is common with the bloggers who use WordPress as their content management system.

How To Fix “Warning Cannot Modify Header Information” Step By Step Guide!

This type of problem can be so annoying because the admin is unable to access the site properly. Sometimes the dashboard can be accessed but sometimes not. Instead, you will get an error on the page or dashboard area.

Warning: Cannot modify header information - headers already sent by /public_html/wp-includes/pluggable.php on line (number of the line that has error)

Why you face “Cannot Modify Header Information” WordPress Error.

You may not be able to understand the error completely as a non-technical person. But there are specific reasons, that cause this error when accessing your WordPress dashboard. Let’s see which causes are responsible for this annoying error.

  • Trying to provide the output before it’s generated properly
  • Usage of too many white spaces at the starting of the header section within the code.
  • when the content of the page body is sent before the headers.

The error can be caused by any of the above failures or mistakes. But we can fix them easily if we go through step by step process and fix it from the root destination from where the error was generated.

Use Following methods To Fix “Cannot Modify Header Information” WordPress Error

After understanding the cause of the error it’s time to get rid of this annoying error. There are various methods you can implement easily to fix this error in no time. But you will have to find out which method works for you.

1. Updating The Faulty File

When you encounter the error look for the file path that is shown in the error along with other information. If your host’s file structure is common like other hosting providers then it will be easy for you to locate the faulty file.

For example, if your error is represented like the following, then you can find the faulty file easily and edit it for replacing it with the proper one.

Warning: Cannot modify header information - headers already sent by /public_html/wp-includes/pluggable.php on line

When you have gained access to the faulty file replace it with the file which is working fine. you can use an FTP client like Filezilla or Cpanel for performing this task easily.

2. Removing Extra Blank Spaces

Extra blank spaces between the PHP code are one of the main reasons for the “warning cannot modify header information” error. So you can remove them from your file to get rid of the problem easily.

In order to access and edit your faulty file, you can either use an FTP client or Cpanel whichever you prefer. When using FTP client you can log in to your account using the credentials provided by your hosting provider.

After you have logged in find your faulty file by using the path described in the error. And remove any extra blank spaces before and after the <? PHP and ? > tags in your code. That will remove any confusion while executing the PHP code.

By removing these extra blank spaces you can fix the “warning cannot modify header information” error easily. if your problem is still not solved then you can try other methods which are described below.

3. Using Output Buffering Functions

There are lots of functions available in PHP which provides additional functionality and better performance to your site. So we can use some of those codes for solving our problem of headers.

The codes which we are going to use are functions that can be useful for output buffering. let’s have a look at how to use these codes in your faulty file to solve the issue.

1.OB_START();

<? PHP
ob_start();
//----file body----//;
? >

2. OB_END_FLUSH();

<? PHP

//----file body----//;

ob_end_flush();

? >

As stated before you can use an FTP client service or Cpanel for editing the faulty file easily. By using these functions in your file. It will allow the headers to be stated outside the page while it’s being buffered.

This could be a possible solution for fixing your “warning cannot modify header information” WordPress error easily.

4. Avoid Sending Any Output Before The Headers

If you have gained access to your faulty file and tried all the methods mentioned above then you can try this method too. There are thousands of themes and plugins available in WordPress that can be used to improve the performance and appearance of your site.

But sometimes these files include some code that sends output before the headers. That can be a possible cause for headers to not perform properly. So you should avoid sending any output before the headers in the file.

For example, look at the below PHP code. Where output is sent before the headers that are not meant to be the ideal structure for the proper functionality of any website/blog.

<? PHP

Echo "This is the output"; (output sent before the headers) Header(...);

? >

You can easily remove these type of lines which are being used to send any type of output before the headers. Easily access your file via FTP or Cpanel and remove the unnecessary code that is sending output before the headers in the file.

Conclusion

These were some of the possible solutions for fixing “warning cannot modify header information” error easily. You can use any of them to solve your problem but is you still find it difficult to solve the problem and access your site then you can try contacting the help and support team of your hosting provider for expert help.

If you found any informative content in this article then please share this knowledge with others. And don’t forget to mention any doubts or queries you have regarding this error.

About the Author: Arvind Panwar

Leave a Reply

Your email address will not be published. Required fields are marked *