Make WordPress Core

Opened 7 years ago

Last modified 4 months ago

#28569 reviewing enhancement

Calling show_admin_bar( false ) should dehook toolbar entirely

Reported by: danielbachhuber Owned by: davidbaumwald
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Toolbar Keywords: has-patch needs-refresh
Focuses: Cc:


Because I'm only hiding the toolbar in certain contexts, I'm calling show_admin_bar( false ) right before get_header(). #16249 was closed suggesting the function should only be called on init. #21746 suggests calling after plugins_loaded However, I think calling it after the query is set and the template is picked is a valid use case.

As such, I'd propose calling show_admin_bar( false ) should run remove_action('wp_head', '_admin_bar_bump_cb'); and similar setup callbacks.

Attachments (1)

28569.patch (428 bytes) - added by paulschreiber 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @paulschreiber
7 years ago

What other callbacks count as "and similar setup callbacks"?

7 years ago

#2 @helen
7 years ago

  • Keywords has-patch added; needs-patch removed

#3 @DrewAPicture
7 years ago

  • Owner set to paulschreiber
  • Status changed from new to assigned

#4 @chriscct7
6 years ago

  • Owner changed from paulschreiber to chriscct7
  • Status changed from assigned to reviewing

This ticket was mentioned in Slack in #core by sabernhardt. View the logs.

6 months ago

#6 @sabernhardt
6 months ago

  • Milestone set to 5.8
  • Owner changed from chriscct7 to davidbaumwald

The patch still applies, though it could use a Yoda condition on the check.

Also, it would help if someone with deeper knowledge of the admin bar (and/or themes) agrees this is the correct way to do this. I have used the show_admin_bar filter before, and returning false with that removes the style tag. But I have not used show_admin_bar( false ) to know how that works.

Last edited 6 months ago by sabernhardt (previous) (diff)

This ticket was mentioned in Slack in #core by sabernhardt. View the logs.

4 months ago

#8 @sabernhardt
4 months ago

  • Keywords needs-refresh added; good-first-bug removed
  • Milestone changed from 5.8 to Future Release

It's a bit late for 5.8. Moving to future release.

Note: See TracTickets for help on using tickets.