WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#19685 closed enhancement (wontfix)

Allow hiding admin bar in wp-admin section

Reported by: benallfree Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Toolbar Keywords:
Focuses: Cc:

Description

Presently, the admin bar cannot be hidden in the wp-admin section. This need arises in use cases where the operator desires to expose the user profile and certain other features to users, but does not wish to expose the dashboard or admin bar. Plugins exist to help hide the dashboard and admin bar in general, but admin bar visibility is currently hard-coded when in /wp-admin.

This enhancement allows other plugins to override this default behavior.

Attachments (1)

hide_admin_bar.diff (413 bytes) - added by benallfree 3 years ago.

Download all attachments as: .zip

Change History (7)

@benallfree3 years ago

comment:1 @nacin3 years ago

  • Component changed from General to Toolbar
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

The Toolbar is integrated into the admin now. It is the merger of the admin header and the Admin Bar. There's no removing it, certainly not as easily.

comment:2 @benallfree3 years ago

Thanks for the quick response. I'm not sure I understand though. Trunk still contains is_admin_bar_showing() with a filter to hide the admin bar.

I get frequent requests to customize the wp-admin/ experience for regular/nonprivileged users. Normally this involves hiding the toolbar/adminbar and removing Dashboard access. Hiding the admin bar presently requires a core mod.

comment:3 @nacin3 years ago

If you remove the toolbar, there's no longer an admin header. That's hardly desirable.

There are actions you can still unhook to disable it without a core mod. It's just a bad idea in general.

comment:4 @jane3 years ago

It's still called admin bar in the code, but the toolbar is now on par with the left side navigation. It's not an add-on, it's part of the base application. It can be hidden on the front end b/c you aren't technically in the application when viewing a site.

comment:5 @benallfree3 years ago

Thanks Jane. This is my first patch attempt, so maybe I'm mixing up vocabulary.

I am talking about the horizontal bar across the top of the admin and front end pages when the user is logged in. There is already core code to hide the bar on the front end pages, but for some reason it is hard-coded to show on the wp-admin/ side.

I am not aware of any side effects from my patch. It simply prevents the bar from rendering if a filter handler disables it. This is often requested to simplify the user experience because normal site users are sent to wp-admin/ to modify profile settings and possibly perform other user-level features, but they don't need that horizontal bar (just the vertical menu on the left).

If there are indeed no side-effects to hiding the top bar in the admin, I would presume it's a good idea to use the filter that's already there.

If the concern is that my change will break plugins that intended to hide the admin bar only for the front pages, we could introduce a new 'show_admin_bar_in_admin' filter instead of hard-coding it to false if is_admin() is true. That way it could be overridden without breaking existing plugins.

Sorry if I'm missing some major technical issue. It seems like all other admin functionality remains intact even if this admin bar doesn't render.

comment:6 @jane3 years ago

You are missing the thing that both Nacin and I have said. The "admin bar" as it once was, optional stuff that you could choose to have or not have, is no more. It has been merged with the dashboard header when in wp-admin, and is no longer optional when in wp-admin. This is 100% intentional. We designed the toolbar (yes, the narrow strip across the top) to be the new dashboard header. Some people are confused because it *looks* like the old admin bar. However, it provides navigation not available elsewhere. Removing it in wp-admin would be like removing the left-hand navigation sections. If you take it out, the site name will not even appear anywhere. We will not provide an option to remove it from the dashboard.

Note: See TracTickets for help on using tickets.