PHP Warning: Cannot modify header information – headers already sent by (#) in # on line #

This post may contain affiliate links. As an Amazon Associate I earn from qualifying purchases.

I got another wordpress error message while doing some maintenance work at truck trailer news website which is currently using the worldpress content management system (for wordpresses easy updating and backup features among other reasons). This happened after I installed a new wordpress theme and made some edits in the footer.php file of the theme and then when I pressed the update button.

My first thought was that the theme creator had somehow barred editing the themes footer file so his links or credit hyperlinks will not be modified or removed by the themes users. Seems fair enough. The next time I tried to login as webmaster for that website it again showed the wordpress header already send by online blah blah error and I couldn’t login to the wordpress dashboard or any other inner wordpress files of the site.

wordpress php error

The error message I got on firefox browser was:

Warning: Cannot modify header information – headers already sent by (output started at /home2/ … /functions.php:333) in /home2/univesg3/public_html/truckandtrailernews/wp-includes/pluggable.php on line 890

Pretty fix similar to the one wordpress error I mentioned in a earlier article here at AKŞAM about the WordPress Plugin “You do not have sufficient permissions to access this page” error message solution.

However when I did a internet search for a solution for this problem this seemed to be a very common problem. After some reading, (i’m not versed with php programming and aversed to technical terms what can’t avoid have to read them to solve your wordpress problems.)  I found two solutions.

Solution 1 for Cannot modify header information
One was by who said the solution for this problem was

1. Download your wp-config.php down via FTP (Edit directly if you have SSH access)
2. Open wp-config with your favourite editor, and remove all spaces before “<?php” and after “?>

Solution 2 for Cannot modify header information

The other solution for this error was at blog. It was a wordy post and I just skimmed it. You can read his solution at Solve “Cannot modify header information – headers already sent by *.php” It’s a very technical read but at times this solution may be the only solution if you happen to get this error in your wordpress blog. So worth checking out.

How I solved this WordPress PHP Warning Error – Cannot modify header information

php modify header error
But the solution to my problem came from a comment posted to the first solution I mentioned here. According to that comment someone who got this error had removed the unnecessary multiple PHP open and close tags (like <?php” and after “?> ) in the function.php file of your wordpress installation.

When I checked my wordpress functions.php file by logging into my web hosts server and accessing the relevant .php file directly through my bluehost CPanel code editor, sure enough I found multiple PHP open close tags. I removed them, saved and the problem was solved. 🙂

Leave a Reply

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