admin管理员组文章数量:1323335
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 thefunctions.php
Ensuring both
functions.php
andwp-config.php
had no spaces at beginning or end of fileOpening
wp-config.php
andfunctions.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 indebug.log
, except for 2 that relate to when I hadn't fully uploaded some files. That particular error mentionednav-menu.php
; this confirmed that it is reporting errors, just not related to my login issuesI renamed each plugin folder with
_tmp
at the end to try and rule out any plugins causing the problemI 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?
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 thefunctions.php
Ensuring both
functions.php
andwp-config.php
had no spaces at beginning or end of fileOpening
wp-config.php
andfunctions.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 indebug.log
, except for 2 that relate to when I hadn't fully uploaded some files. That particular error mentionednav-menu.php
; this confirmed that it is reporting errors, just not related to my login issuesI renamed each plugin folder with
_tmp
at the end to try and rule out any plugins causing the problemI 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?
Share Improve this question edited Nov 17, 2015 at 1:49 Gabriel 2,24810 gold badges22 silver badges24 bronze badges asked Nov 16, 2015 at 22:50 stemlundstemlund 3071 gold badge2 silver badges5 bronze badges 5 |9 Answers
Reset to default 10 +25This 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.
You can follow these steps written below:
- Rename
themes
directory andplugins
directory. - Now visit /wp-admin/ or /wp-login.php. I hope this time it would work.
- If step 2 works, then login to the dashboard.
- Now, Rename
themes
directory again intothemes
- Then, visit
Appearance
menu and activate any default wordpress theme. - I hope, this point you can access the front-end also.
- 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.
- If step 7 works, then you can rename back the
plugins
directory asplugins
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
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.
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/Editing_wp-config.php#Set_Cookie_Domain and use define( 'COOKIE_DOMAIN', 'www.askapache' );
in your wp-config.php.
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.
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.
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
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.
In some cases if you are seeing errors or warnings on the login page you can try setting define('WP_DEBUG', false); in wp-config.php as a temporary fix and once you login you have to fix the actual issue which is in most cases an outdated plugin or theme. I've solved it like this in some cases and then once logged I updated everything and it was fixed.
本文标签: wp configLogin page ERROR Cookies are blocked due to unexpected output
版权声明:本文标题:wp config - Login page ERROR: Cookies are blocked due to unexpected output 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742136498a2422394.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
/wp-login.php
URL. – Prasad Nevase Commented Jan 2, 2016 at 15:29