Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#36215 closed enhancement (wontfix)

Friendlier "headers already sent" error message on wp-login.php

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords: ux-feedback good-first-bug has-patch
Focuses: Cc:


When a user first installs WordPress and manually configures their wp-config.php file, a rogue leading or trailing space, tab, new line, or other character in this file can prevent the user from logging in due to the "headers already sent" error. See #36213 for a recent example.

In order to make this error condition friendlier, wp-login.php should perform a headers_sent() check before sending cookies and display a friendlier error message if headers have already been sent. Rather than a verbose error message, a link to a relevant Codex or Handbook article could be provided.

Attachments (2)

36215.patch (684 bytes) - added by juanfra 8 years ago.
Print error if headers were sent already
Screen Shot 2016-08-29 at 14.10.51.png (71.9 KB) - added by johnbillion 8 years ago.

Download all attachments as: .zip

Change History (8)

#1 @ericlewis
8 years ago

  • Milestone changed from Awaiting Review to Future Release

Great idea!

8 years ago

Print error if headers were sent already

#2 @juanfra
8 years ago


I think this would be great for newcomers. We should define a string for the error. I've suggested one in my patch.

Also, I've seen there are a lot of non-compliant code regarding the WP coding standards. Wouldn't be this a good opportunity to work a bit around this file?

We can also add some html to make the message look prettier. Should I try something out? (Something somehow closer to the look and feel of the login page).


Last edited 8 years ago by juanfra (previous) (diff)

#3 @DrewAPicture
8 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner set to juanfra
  • Status changed from new to assigned

Assigning to mark the good-first-bug as "claimed".

See 36215.patch

#4 @johnbillion
8 years ago

  • Milestone changed from Future Release to 4.7
  • Owner changed from juanfra to johnbillion
  • Status changed from assigned to reviewing
  • Type changed from feature request to enhancement

#5 @johnbillion
8 years ago

  • Milestone 4.7 deleted
  • Resolution set to wontfix
  • Status changed from reviewing to closed

It turns out that this functionality is already in place. See the above screenshot.

I thought about suppressing the Cannot modify header information - headers already sent errors that appear if error output is enabled, but this actually proves to be a very effective phrase to search for in addition to following the links in the above message.

#6 @juanfra
8 years ago

Good! That looks great. The only thing (from what I've tested) is that the error message is displayed when somebody goes (or is redirected) to wp-login.php directly. If you visit wp-admin/ there's not any kind of notice, and you get the php error.

Note: See TracTickets for help on using tickets.