EasyHostingASP.NET | Best and cheap WordPress Hosting. The “Cannot modify header information” error is one of the common errors in WordPress. When this error occurs, your visitors will see the paths to several files on your server instead of the real content that they want to access, which not only ruins the user experience, but also brings security threats.
Fortunately, the error is not as complicated as it seems since it doesn’t mean there is really something wrong with the header file of your theme. Now we’d like to show you some details about this error and the fixes to it.
What the Error Is
As is shown in the example below, the “Cannot modify header information” error has nothing to do with your theme’s header.php file. Instead, it is caused by the unneeded extra blank spaces or lines in your files. Such blank spaces may have been added intentionally or unintentionally.
You may feel a headache when faced with such an error because it seems hard to find the exact blank spaces. However, the error message has already shown you what you should do to fix the trouble.
In an error message, there are the paths to two files on your WordPress site. The first file is the broken one that needs a fix, and the second file is exactly the one that has been negatively affected by the error. You don’t need to do anything to the second file.
Besides, in the path to the broken file, you can easily find the line number of the extra blank spaces. In the example, the blank spaces are on the line one of the functions.php file of the active theme.
How to Fix WordPress Cannot Modify Header Information Error
Depending on your coding knowledge, there are two possible solutions for you. One is to access your server through FTP or cPanel, download the file with problems, and then modify it manually. Simply find the problematic line, and delete the unneeded blank spaces or lines. Besides, make sure that there is no blank space at the beginning or the end of the file, which means no blank space before the <?php tag and after the ?> tag. After saving the file, upload it back to the place it should be and replace the old file.
The other solution is to upload a fresh copy of the file to your server. If you are quite sure that you haven’t made any change to the problematic file since you downloaded the theme or plugin, you can download the exact theme or plugin again to your local computer, find the file your need, and upload it to overwhelm the old one. This should fix the issue, too.
According to our experiences, the former solution is more widely adopted since no coding skills are required while you don’t need to worry about the loss of customizations.
When clearing the blank spaces manually, you must be careful enough so that no other character is added unintentionally that generates new issues. Besides, you have to use a good text editor like Notepad instead of a word editing program like Microsoft Word. Also, make sure the encoding is UFT-8.
After fixing the error, you may also want to hide the error messages from the frontend visitors of your WordPress site so as to improve the website security. You can do this with WP_DEBUG.
Latest posts by Alexia Pamelov (see all)
- 35% OFF Best ASP.NET Core 2.0 Hosting in Australia - August 22, 2017
- BestASP.NET Core 2.0 Hosting Comparison :: UKWindowsHostASP.NET vs UnitedHosting - August 21, 2017
- Best ASP.NET Hosting Comparison – WebHostingBuzz VS HostForLIFE - August 18, 2017