Make WordPress Core

Opened 5 years ago

Last modified 5 weeks ago

#48831 new enhancement

WP Admin Bar doesn't display on wp-login.php page

Reported by: henrywright's profile henry.wright Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Toolbar Keywords: has-patch changes-requested 2nd-opinion close
Focuses: Cc:

Description (last modified by sabernhardt)

I like to display the WP Admin Bar on all pages even if a user isn't authenticated because we get the WordPress logo and menu and a search button. To always show the WP Admin Bar we can do this:

add_filter( 'show_admin_bar', '__return_true' );

This will display it everywhere except wp-login.php. I think it _should_ display on this page if we return true in the filter

Attachments (3)

48831.diff (1.5 KB) - added by donmhico 5 years ago.
48831.2.diff (2.2 KB) - added by donmhico 5 years ago.
With CSS fix.
48831.3.diff (2.0 KB) - added by sabernhardt 3 years ago.
check that filter returns true and that the page is not an interim login

Download all attachments as: .zip

Change History (14)

#1 @henry.wright
5 years ago

I think it _should_ display on this page if we return true in show_admin_bar()

I can't edit the ticket description but I should have said:

I think it _should_ display on this page if we return true in the filter.

#2 @henry.wright
5 years ago

  • Component changed from General to Toolbar

#3 @henry.wright
5 years ago

This is because wp-login.php uses a different set of hooks. login_header and login_footer are used instead of wp_head and wp_footer

@donmhico
5 years ago

#4 @donmhico
5 years ago

  • Type changed from defect (bug) to enhancement

@donmhico
5 years ago

With CSS fix.

#5 @donmhico
5 years ago

Hello @henrywright,

I attached a patch, https://core.trac.wordpress.org/attachment/ticket/48831/48831.2.diff, that should address this ticket.

P.S. - I changed this ticket from bug to enhancement as I feel that this is more of an enhancement.

#6 @donmhico
5 years ago

  • Keywords has-patch added

#7 @SergeyBiryukov
5 years ago

I like to display the WP Admin Bar on all pages even if a user isn't authenticated because we get the WordPress logo and menu and a search button.

Just noting there's a Logged Out Admin Bar plugin used on WordPress.org for that purpose, though it doesn't display the toolbar on the login page either.

#8 @henry.wright
5 years ago

@donmhico I think you are right to set this to an enhancement. It isn't really a bug

Thanks @SergeyBiryukov

#9 @sabernhardt
3 years ago

  • Description modified (diff)

@sabernhardt
3 years ago

check that filter returns true and that the page is not an interim login

#10 @sabernhardt
3 years ago

Latest iteration: 48831.3.diff

I moved the actions into wp-login.php so it checks whether the filter returns true (not every case of showing toolbar). The toolbar also does not fit in an interim login.

For the CSS, I prefer resetting form element styles along with the links, and the search input min-height matches the height. The html element includes an admin-bar class so the full height layout can subtract the toolbar height from 100% (using the new custom property).

#11 @sabernhardt
2 months ago

  • Keywords changes-requested 2nd-opinion close added

48831.3.diff​ has a coding standards error in the html element. It also would add a navigation landmark role, and the page should have additional landmarks and/or a skip link to go with that (#51786).

However, with no progress in 3 years, I am more inclined to close the ticket. In addition to the Logged Out Admin Bar plugin, BuddyPress has a similar option in its plugin and that does not show the toolbar on the login page either. Maybe this concept would fit better as part of the proposed admin redesign.

Last edited 5 weeks ago by sabernhardt (previous) (diff)
Note: See TracTickets for help on using tickets.