Cookies are blocked due to unexpected output in Wordpress
Asked Answered
E

13

9

Couple of days back, i got this error when i was trying to login

Error

i did find out some solutions such as:

  1. Renaming Plugins folder
  2. Replacing Files which are giving error.

But these are not working in this case, still problem exists, so any help here would be appreciated.

The error:

ERROR: Cookies are blocked due to unexpected output.

This is server error log:

[10-May-2014 14:02:28 UTC] PHP Notice:  Use of undefined constant WP_TEMPLATE_URL - assumed 'WP_TEMPLATE_URL' in /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php on line 115
[10-May-2014 14:02:28 UTC] PHP Notice:  Use of undefined constant WP_TEMPLATE_URL - assumed 'WP_TEMPLATE_URL' in /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php on line 118
[10-May-2014 14:02:28 UTC] PHP Notice:  Use of undefined constant WP_TEMPLATE_URL - assumed 'WP_TEMPLATE_URL' in /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php on line 119
[10-May-2014 14:02:28 UTC] PHP Notice:  Undefined index: __getthere in /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php on line 189
[10-May-2014 14:02:28 UTC] PHP Notice:  Undefined index: __getthere in /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php on line 202
[10-May-2014 14:02:28 UTC] PHP Notice:  Undefined index: __getthere in /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php on line 213
[10-May-2014 14:02:28 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php:115) in /home/paragint/public_html/wp-login.php on line 414
[10-May-2014 14:02:28 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php:115) in /home/paragint/public_html/wp-login.php on line 426

Update: This issue basically occurred due to file encoding UTF-8 BOM instead of the usual UTF-8 in WordPress 3.9 but any idea how to get rid of that? because saving the file is not working out for me.

Exhort answered 12/5, 2014 at 18:4 Comment(3)
Input > Handling > Output. These steps wont used by your theme. Add ob_start(); at the first line in your functions.php (It's not the best practice), or fix the issue by following following rules: data input > data handling > print out the resultPecoraro
@AdrianPreuss i am not sure what you want to suggest.Exhort
thats are basics of programming: Data input > Data handling > Output, The IPO Model: en.wikipedia.org/wiki/IPO_ModelPecoraro
E
2

I tried following solutions by which similar issues get resolved

  • Changing file formats (UTF-8 BOM to UTF-8)
  • Renaming Plugins folder
  • Replacing Files which are giving error (On enabling wp-debug)

But in my case final solution was to upgrade the WordPress, or more likely you can say replacing core WordPress files using FTP. I followed this guide for manual upgrade: http://codex.wordpress.org/Updating_WordPress

Exhort answered 7/1, 2015 at 7:30 Comment(1)
Renaming the plugins one by one and then renaming them back - refreshing after every rename resolved my issue. There was a problem one, which I renamed last and then everything worked.Donahue
G
16

I had same issue. What I did is I added ob_start() at top of wp-config.php then it allows me logged in. After that I update one of plugin that was requite to update. Then I logout and removed ob_start() and the error was gone and never came back again.

Goodfornothing answered 1/8, 2016 at 21:11 Comment(0)
T
4

I was also faced with the same error.

I solved it by adding ob_start(); at the start of wp-config.php then it worked perfectly.

Tetter answered 14/1, 2021 at 12:9 Comment(0)
E
2

I tried following solutions by which similar issues get resolved

  • Changing file formats (UTF-8 BOM to UTF-8)
  • Renaming Plugins folder
  • Replacing Files which are giving error (On enabling wp-debug)

But in my case final solution was to upgrade the WordPress, or more likely you can say replacing core WordPress files using FTP. I followed this guide for manual upgrade: http://codex.wordpress.org/Updating_WordPress

Exhort answered 7/1, 2015 at 7:30 Comment(1)
Renaming the plugins one by one and then renaming them back - refreshing after every rename resolved my issue. There was a problem one, which I renamed last and then everything worked.Donahue
G
1

I had the same error and was not able to fix it with the answers here in this thread nor this thread helped me: https://wordpress.stackexchange.com/questions/208878/login-page-error-cookies-are-blocked-due-to-unexpected-output

My solution is:

  1. Open your WP directory with FTP and download the wp-config.php file
  2. Copy the information in the wp-config.php file
  3. Open a standard text editor (I used the Windows text editor)
  4. Paste the information you just copied, into the empty text editor.
  5. Save the file as wp-config.php and choose ANSI as encoding!

wp-config.php editor text ANSI

  1. Replace the new wp-config.php file with your exisiting one.

Done. This helped me.

Gillie answered 23/11, 2018 at 13:0 Comment(0)
A
1

First Check your Error_Log

My problem was a line space in the Wp-config File. space removed problem solved

Angola answered 23/9, 2021 at 7:43 Comment(0)
F
0

just remove white spaces before phptag start and after php ending tag in wp-includes/plugable.php , may be resolve your problem.

Fibrinous answered 6/1, 2015 at 5:52 Comment(0)
C
0

I had the same issue and none of these step were able to fixed it. I was able to solve my problem by enabling output buffering in my php.ini file.

This worked for me and I just wanted to post for the people that are still having trouble after all of the other steps. Try looking into output buffering either php.ini or user.ini depending on your server setup.

Colloidal answered 30/12, 2016 at 0:27 Comment(0)
C
0

In my case I have edit some theme file but my mistake was I have gave a "." & "space" on start so if you facing same problem then please remove . & space from you code and make sure check your recently edited file in no error showing that's it !

Coquina answered 14/10, 2020 at 11:9 Comment(0)
F
0

For me, it was because my WordPress 6.1 had a warning from PHP 8.1 Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool

Downgraded to PHP 7.4 and worked properly. you can also check the debug.log file for any issues.

Fernanda answered 2/2, 2023 at 10:23 Comment(0)
K
0

In my case it was unnecessary

?>
/empty line/

at the end of functions.php Just had to delete these 2 lines.

Katinakatine answered 21/7 at 20:28 Comment(0)
S
-1

Looks like all the errors are coming from your mobile index.php file. Try renaming it to something wordpress won't parse, eg. index.php_backup

The file location- /home/paragint/public_html/wp-content/themes/RockStarLeadTheme-v2-4/functions/mobile/index.php

Shore answered 12/5, 2014 at 19:7 Comment(0)
P
-1

My solution was to turn 'WP_DEBUG" in wp-config to true (located on line 81) and after trying to log in I was directed to the offending piece of code (was was shown on the top of the page).

Mine was located in my theme's functions.php, turned out to be the script I added to include fontawesome. I simply removed this script and was able to log back into the dashboard.

President answered 2/7, 2014 at 5:41 Comment(1)
This is not a issue of manually adding any other code or any theme specific issue, it spread to many users when they updated their WordPress version to 3.9, Because new version used file encoding UTF-8 BOM instead of the usual UTF-8. So that is the issue, but how get rid of that?Exhort
C
-1

This is the method that solved my problem.

Delete your current wp-config.php file then run the config again (by going to http://yoursite/wp-admin)

I got this problem because I copied the WP Debug code from outside source. So, the best way is to type the code in your wp-config.php file, not copy from somewhere else and paste into your file.

Collect answered 22/10, 2014 at 5:39 Comment(2)
In my case i didn't touch anything in the code, it was due to a WordPress bug. So by just updating WordPress it occurred.Exhort
I see. The causes could be different. Have you tried re-creating the wp-config.php file?Astrogeology

© 2022 - 2024 — McMap. All rights reserved.