After migrating site to another account on same host, I started to receives strange errors. Firstly I encountered an error where at the login page I was asked to turn on Cookies. And after I deleted that part of the file in wp-login.php (I turned off that test cookie wp is setting when user is wp login screen).

Nowm when I visit my site without www, so just domainname.com, and when I visit wp-login.php and try to log in, I get a Headers already sent error, for file pluggable.php on line 897

I tried all standard solutions including:

  • Downgrading Wordpress
  • Reseting plugins folder
  • Checked if my files are started and ended regulary with
  • Checking sites URL in phpMyAdmin, reseting permalink structure

My sites on two accounts have exact same files, dbs and settings I have properly done the migration itself, and changed the links in the database. Both of the sites are on new server, that has exact same configuration :)

Any ideas?

Thanks in advance

  • 2
    "And after I deleted that part of the file in wp-login.php" Did you actually went and deleted code from a core file? Commented Mar 29, 2014 at 5:15
  • I removed the three lines where WP sets test cookie for the user that came on wp-login.php That shouldnt affect other functionalitites. Any ideas? Commented Mar 29, 2014 at 12:12
  • Post the error message exactly as it appears. Copy and paste it.
    – s_ha_dum
    Commented Mar 29, 2014 at 14:07
  • 2
    Useful codex: codex.wordpress.org/…
    – Tara
    Commented Oct 21, 2016 at 23:41

5 Answers 5


It is usually because there are spaces, new lines, or other stuff before an opening tag, typically in wp-config.php. This could be true about some other file too, so please check the error message, as it will list the specific file name where the error occurred.

Other Resources:

  • File is Pluggable.php, no errors there. Commented Mar 29, 2014 at 12:11
  • Good point. The problematic file was functions.php in my situation, and the problem was an unexpected ?> close tag an some spaces after it.
    – dgonzalez
    Commented Apr 21, 2017 at 9:22

I had the same error. The problem was I had multiple php tags. Just use a single set. Ie:

==== BAD ====


==== GOOD ====

  • Multiple tags don't do anything wrong it is the whitespace between them, but it is a goo trail to follow - the strayed whitespace.
    – Picard
    Commented Jul 10, 2017 at 6:01

Headers already sent error, for file pluggable.php on line 897

You need a solution to the problem above, and that is very easy. Reinstall a fresh copy of Wordpress

I was asked to turn on Cookies. And after I deleted that part of the file in wp-login.php (I turned off that test cookie wp is setting when user is wp login screen).

There is no bigger sin in Wordpress programming than to hack, change, delete or add any type of code, no matter how small to core files, themes and plugins. And excuse me for shouting, but NEVER EVER, AND I MEAN EVER, DO THAT!!!!!!

Wordpress are coded and tested by some of the top coders in the world. All new versions goes through very tough testing, and by the time a new version goes live, all bugs are sorted. Wordpress developers also keep Wordpress up-to-date and new versions are regulary released. So, if anything goes wrong with your installation, 99.99999% it is not Wordpress.

That said, even if a problem is related to the core, YOU SHOULD NEVER EVER CHANGE CORE FILES, PERIOD.

The same apply to themes and plugins that aren't yours. Theme files and plugin files should also never ever be changed, and like in never, and only when you are the author. That is what child themes are for.

Why should you never change core, theme or plugin files? The answer is simple, As with Wordpress core, many themes and plugins available, updates are always available, and if you made any changes to these files, your changes will be overwritten, and you will loose them for ever, and there is no turning back.

Always always use a child theme, and always always make changes inside that child theme. As previously said, the only time you can change theme and plugin files is when you are the author.

That said, what should you do if you encounter a problem?

Debug, debug, debug, always debug. That is one aspect that so many miss, and most of the time setting debug to true in wp-config.php will exactly print your problem, so you will immediatly know where to start looking.

if debugging gives up nothing, you should firstly deactivate all plugins, one by one, and check after each one if the problem remain or if it is solved. Most of the time this will solve your problem. If that doesn't work, deactivate your theme and activate one of the default themes that is shipped with wordpress. If that solves your problem, you know it is your theme. If your problem however remain, your problem is usually core related or server related. If you suspect it might be the core that is corrupt, just install a fresh copy. (Always make a backup before you do that). If it is server related, it is always a great idea to speak to your hosting provider first.

I would urge you, reinstall a fresh copy of wordpress and start from the top and follow my instructions, and if that doesn't solve your problem, or if you are unsure what is causing it, edit your question or start a new one with the details of the actual problem " I was asked to turn on Cookies".

I hope this not only helps you, but everyone how finds this page.


I have added ob_start(); at the start of wp-config.php and my error gone.


I add ob_start(); to top of my pluggable.php and works - magic.

Line 1 of file would be:

<?php ob_start();
  • 1
    this just hides the issue, it doesn't fix it.
    – Milo
    Commented Aug 25, 2015 at 15:44
  • It does not fix the headers being sent, but fixes the error message. The question was any ideas. Maybe it is not worth fixing the headers issue if it can be hidden so easily. Would you prefer this answer that fixes the error message so he can continue his list? He already said he cant find the error that is causing it. What do you want him to do?
    – Jon
    Commented Aug 26, 2015 at 11:29
  • A good start would be to paste the entire error message, as was requested. It contains the answer, if you understand what it's telling you (the problem is not in pluggable.php, it is just revealed there). I'd rather help someone learn how to properly debug issues than show them how to hide them and create more problems for themselves down the road.
    – Milo
    Commented Aug 26, 2015 at 15:19
  • He pasted the whole error - Headers already sent error, for file pluggable.php on line 897 Thats what the error message is. No more. And in the absence of the chance to debug, dont try to hide it, so he can move on with his life? He'll be back down the road anyway...
    – Jon
    Commented Aug 26, 2015 at 15:26
  • It's not the whole error, it's only half, which is why a mod commented and requested the whole error message be pasted.
    – Milo
    Commented Aug 26, 2015 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.