10

I have a WordPress website that I recently discovered had this error on the login page:

ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums.

I can only access the login page from wp-login.php, since /wp-admin/ displays a blank white page.

I've searched the web and tried many things with no success:

  • Removing ?> and space at end of the functions.php

  • Ensuring both functions.php and wp-config.php had no spaces at beginning or end of file

  • Opening wp-config.php and functions.php in Notepad++ and converting to UTF-8 (people recommend 'without BOM' but that is only an option in the newest version of Notepad++ - I'm guessing UTF-8 does that now)

  • I've set WP_DEBUG to true and have received no errors in debug.log, except for 2 that relate to when I hadn't fully uploaded some files. That particular error mentioned nav-menu.php; this confirmed that it is reporting errors, just not related to my login issues

  • I renamed each plugin folder with _tmp at the end to try and rule out any plugins causing the problem

  • I also renamed the plugins folder to rule out all plugins at the same time

Given these things I've tried, and that I'm not receiving any PHP errors, what else could I try?

  • Can you please share your website URL? Would like to actually see by accessing /wp-login.php URL. – Prasad Nevase Jan 2 '16 at 15:29
  • 2
    Does fresh WordPress installation in subdomain or subdirectory on the same hosting has the same problem? – Alexey Jan 2 '16 at 17:13
  • have you resolved the issue? And if so, how? – MatoBehr Jun 28 '16 at 20:01
  • You can check this guide here for this fix - truetutorials.com/… – user103133 Sep 19 '16 at 14:40
5

You can follow these steps written below:

  1. Rename themes directory and plugins directory.
  2. Now visit /wp-admin/ or /wp-login.php. I hope this time it would work.
  3. If step 2 works, then login to the dashboard.
  4. Now, Rename themes directory again into themes
  5. Then, visit Appearance menu and activate any default wordpress theme.
  6. I hope, this point you can access the front-end also.
  7. If that works, then now you can try to activate the theme what you used before. If that works, then probably your them doesn't have any issues.
  8. If step 7 works, then you can rename back the plugins directory as plugins and find if there any problematic plugins are there. If that again breaks your site, then repeat step 1-6 again. If step 7 doesn't work, then repeat step 1-6 again. In this case, your theme has some issues. Fix it.

I hope, it should work for you. Thanks

4
+25

This error is generated in wp-login.php , it happens if server is unable to set cookies, this can happen due to several reasons, one of the common issue is: output being sent before setting up of cookies.

Try out following options:

  • Update WordPress core, if it is not up to date
  • change theme, if you are using custom theme, just ftp into server and delete the custom theme folder, WordPress will revert to default theme.
  • If issue still persists, rename plugin folder

Also check error log, errors may not be printed to screen.

  • ".. or cookies are disabled" ? Not, not this. – Croll Jan 9 '16 at 0:13
  • @DmitrijA thanks for pointing out, you are right, with cookies disabled, error message is different. Updated the answer – Fiaz Husyn Jan 9 '16 at 8:45
  • How can I do any of the above if I can not log in to WP? The only access I have left is FTP. – MatoBehr Jun 28 '16 at 19:59
  • @MatoBehr Using FTP, delete your custom theme folder, if error persists than rename plugin folder. Also check error log to see why this error is being generated – Fiaz Husyn Jun 30 '16 at 10:15
3

Step 1: Check the error logs, to view which file(s) is causing error.Checking your error log file will help you understand what is exactly causing the issue.

Error Logs

Step 2: If the errors are like “Cannot modify header information – headers already sent by (output started at” and then file path and wp-login.php file’s path and line number.This will confirm you that it is UTF-8 BOM issue and you could locate the file that has got the issue.

Notepad Conversion

Step 3: Open the file (In my case it was “custom-posts.php” file) causing error in Notepad++, which has got the issue. It will show you “Encode in UTF-8” selected under Encoding option from the menu. You need to make sure that you have selected “Encode in UTF-8 without BOM” and it is NOT “Encode in UTF-8”, then click on “Convert to UTF-8 without BOM”, hit enter anywhere in your file and save.

It worked for me; however in some cases it can be plugin issue and renaming plugins folder can help. But before making any changes make sure you have checked the error logs so that you know what you are doing.

2

First check your site with a default WordPress theme and if your issue is resolved, so try to check your theme php files and remove any space or new line before <?php and remove ?> at the end of files.

Also check https://codex.wordpress.org/Editing_wp-config.php#Set_Cookie_Domain and use define( 'COOKIE_DOMAIN', 'www.askapache.com' ); in your wp-config.php.

2

As per my opinion this related to some theme issue. Follow below steps and I hope this will your solution.

1. WP_DEBUG to TRUE set the value of WP_DEBUG to TRUE in your wp-config.php file. This will give you a meaningful error message on the wp-login.php page. After solution you can rollback this change.

2. See ERROR
Once you set TURE for WP_DEBUG, you may get Cannot modify header information error message. Based on that message, we can assume that there may be issues with your Theme.

3. Rename theme folder
If point 2, You need to rename your active theme folder name by some value(i.e. mytheme TO mytheme1). You should be able to login though it will default to the current default theme.

4. Active theme again
Once done step 3 and login success, you can again face same blank page issue. Don't worry because this is due to point 3. Active one of the available theme from Admin panels > Appearance > Themes.

NOTE: Don't select your old theme(i.e. we renamed it into point 3) because that theme has got problems. Once you solve that problem you can again use that theme.

For your theme related issue, you can check what is the problem by checking log file.

If still facing same issue, it means that you need to try other option like:
1. You need to update your wordpress version. Check how to
2. Inactive your all plugins, and again activate it.

That's done! Hope this help you well.

1

Seems weird that the error.log doesn't show anything...

To completely rule BOM characters out, I'd try manually retyping any code (in functions.php and wp-config.php) you have copied from other sources into a document you are sure is UTF-8 format. It's possible the characters remained even though the document format was changed in the program.

Added Note: If you aren't sure if your version of Notepad++ supports "without BOM," try using a different editor. Chances are you'd only need to use a different one for this particular issue.

Aside from that, have you tried completely replacing your wp-login.php file? You could try that and/or replacing the entire wp-admin folder. If you had trouble with nav-menus.php not uploading correctly, other files/directories may have failed or partially uploaded as well.

0

I had same issue and i RESOLVED it. I just connect with FTP and change the theme and plugin folder name and i can access the wp admin without any issue. I hope this help others.

Thanks, Nilesh

0

I had this same issue and I was able to log in to the dashboard just renaming the theme folder. So the issue was with my theme.

protected by Community Sep 19 '16 at 15:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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