WordPress fixes part 1 – Warning: Cannot modify header information – headers already sent by…

Just wanted to share this fix – I had this error come up when working on my other blog when I installed my latest theme and could not work out why it was happening. The error message mentioned the functions.php file and pluggable.php file in the error message.

From what I’ve read online, this error is caused by whitespace somewhere in the PHP files noted in the error message. As a precaution I went in and checked every php file in my theme and cleaned any inconsistencies, then checked pluggable.php and got rid of the blank space at the end of the file. Reloaded, still no luck.

I then took another look at my functions.php file, and something occurred to me – I added a php comment field at the top of the file before programming in some stuff in the file, and there was a blank line between the comment php tag and the functions – I removed the comment so it was purely the functions on the first line, and problem fixed!

Previous code:



 '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); ?>

New code:

 '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); ?>

Incedently, you can also see how I set up the sidenav boxes on my other blog this way too in case you’re interested or want to criticise 😛

While everyone might have different issues, hopefully this’ll help someone else who gets this message – check the files indicated in the error message, and if you’ve added a comment to the top of your file for example (like my functions.php file, where I put the theme details in as a php comment and then had a blank space/line underneath), chop it out, re-upload via FTP, and hopefully your issue will be resolved!

I have another WordPress fix to post in the next couple of days on the blog detailing how I setup the drop-down system in my navigation bar in the page header to style the top nav separately from the drop-down boxes to dynamically insert the dividers to the right of each menu item. Stay tuned!

Share

Whew, time to start writing again!

Just wanted to share with everyone that the new site theme for Retro Otaku is finished and has been uploaded. There are still a few bugs to sort out (particularly with the image galleries), but it’s looking very nice. Please feel free to have a look!

The good news is that I can start getting back into writing, rather than coding/designing 🙂 Though the next two posts will be WordPress related as I’d like to share some fixes/tips I’ve picked up from the new themes I’ve put together, so indulge me a little longer 🙂

Share

Companion blogs

Calendar

March 2010
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031