The following message was displayed on the WordPress login screen, and I encountered a situation where I could not log in.
ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums.
When I put WordPress into debug mode, I got the following message:
Notice: is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/users/web/wp-includes/functions.php on line 5535
Notice: is_single was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/users/web/wp-includes/functions.php on line 5535
Warning: Cannot modify header information – headers already sent by (output started at /home/users/web/wp-includes/functions.php:5535) in /home/users/web/wp-includes/pluggable.php on line 1340
Warning: Cannot modify header information – headers already sent by (output started at /home/users/web/wp-includes/functions.php:5535) in /home/users/web/wp-includes/pluggable.php on line 1343
Although it is a message such as a warning, the target file is the core WordPress file.
I don’t remember editing the core file.
Before I got the error, the last thing I edited was functions.php for my theme.
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array('style')
);
}
?>
The theme used is a child theme.
So functions.php is very simple.
There is no error in the code itself.
However, the problem was at the end of the file contents.
I modified it as follows.
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array('style')
);
}
Do you know what changed?
I just removed the last ?>.
Now the error on the login screen has disappeared and you can log in safely.