Headers Already Sent Error in WordPress Plugin Activiation

February 14, 2012

Before I could even start writing plugins for WP, I was experiencing errors. This was the biggest message I got upon activation :

The plugin generated # characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

At the top of the page, it was even worse. You could see errors accumulating before the page was even finished loading –

Warning: Cannot modify header information – headers already sent by (output started at /homepages/37/d354510180/htdocs/BLAH/BLAH/BLAHplugin.php:1) in /homepages/37/d354510180/htdocs/BLAH/BLAH/BLAH/wp-includes/functions.php on line 862

After some Googling, people claimed it was the whitespace at the beginning or end of my PHP file. I cleared all that up, still had a problem. I started messing around with encoding instead.

UTF-8 WITH BOM, and UTF-8 WITHOUT BOM both caused errors upon activation. Finally, I switched to ANSI in “Notepad++” and that resolved it. No issues from there on out.

There are also other methods of adjustment, including your uploading process. I used Filezilla and this can be found under Transfer > Transfer Type.

SOMETHING is putting extra white space in your plugin PHP file… you just need to find out what. Hope this helps.

1 Comment

  • Konjja

    HiWhen I disable the piugln and take out the code from the easy hooks all the headers are removed, as you’d expect. When I activate the piugln with no default header’ the main header appears aligned to the left, even though I haven’t specified one?This is with the:code removed from the easy hooks as you advised. Once I add the code then the header appears where it should and centred but the original one remains?If you click on the coffee shop’ link you will see one of the headers I want to use.I am not really sure what is happening and I want to use the piugln, any help would be great.ThanksKeith

Leave a Reply

Your email address will not be published.