WTF?!? Cookies are blocked due to unexpected output

One of the worst messages you can see in WordPress and especially in production as a developer is: Cookies are blocked due to unexpected output.

This error does not tell you anything, it can be a problem with a plugin (lucky you if you have few of them) or a file in the active theme that is saved in some type of encoding other than UTF-8.

When this error appeared to me recently, the solution in my case was to check the encoding of all the modified files since the date the message appeared in the WP Admin, in each file check the type of encoding and all those that were “UTF-8 BOM ” I saved them again in” UTF-8 “format.

There are many cases of why this error happens, in my case I knew that it was a problem was the current theme because at the time that I renamed the active theme name in the server the WP Admin was gone.

Recommendations:

  • Use an editor that allows you to see the type of encoding of a file
  • The php files save them in UTF-8 encoding
  • Never, but never trust Windows editors 🤦‍♂️

Leave a Reply

Your email address will not be published. Required fields are marked *