WordPress Admin Bar

Note of Plugin Discontinuation:

WordPress 3.1 features a built-in admin bar like this, so I will no longer continue development of this plugin. I recommend uninstalling this plugin as it will no longer be maintained.

Description:

This plugin creates an admin bar at the top of your site for logged in users (i.e. you) based on the design of the admin bar located at WordPress.com. It has links to all popular areas of the admin area, saving you time.

It requires no theme editing whatsoever — just upload and activate and you’re done.

Download:

Adding Custom Themes:

If you’re the author of a WordPress theme or just otherwise wish to add an custom admin bar theme of your own, please check out this plugin’s theme API.

Screenshots:

Frequently Asked Questions

Q: Some plugins don’t show up in the admin bar. What gives?
A: The author of the problematic plugin has a is_admin() test when creating their admin menu which means that if you’re outside of the admin area, their plugin won’t register it’s admin menu. Therefore it of course won’t show up in my admin bar. Contact them and ask them to remove the is_admin() test (or do it yourself).

532 thoughts on “WordPress Admin Bar

  1. zonebattler on February 6th, 2009 at 2:04 AM wrote:

    On all subsequent calls until now, all checkboxes are neatly listed in the _same_ row, regardless if they are 1st-level or 2nd-level options:

    It’s a CSS issue. I thought I fixed it, but apparently not. Doing the same thing on my blog.

    zonebattler on February 6th, 2009 at 2:04 AM wrote:

    Second, the admin bar’s “Plugin” tab icon of the little arrow ist trunctated (cut in half) when the blog is viewed with the Opera browser:

    It’s Opera’s fault. Looks fine here in Firefox and I’m not sure what’s causing it. :/

  2. Viper007Bond on February 6th, 2009 at 2:58 AM wrote:

    [quote comment=”227128″]On all subsequent calls until now, all checkboxes are neatly listed in the _same_ row, regardless if they are 1st-level or 2nd-level options:

    It’s a CSS issue. I thought I fixed it, but apparently not. Doing the same thing on my blog.

    zonebattler on February 6th, 2009 at 2:04 AM wrote:

    Second, the admin bar’s “Plugin” tab icon of the little arrow ist trunctated (cut in half) when the blog is viewed with the Opera browser:

    It’s Opera’s fault. Looks fine here in Firefox and I’m not sure what’s causing it. :/[/quote]

    Thanks a lot for the quick response! Well, if you can live with the CSS issue, so will I!

    And about the arrow icon being cut in half by Opera: it seems to be a spacing and/or padding issue. Are there any tables involved with fixed cell width? Opera is renowned to be quite precise (if not stubborn) in interpreting HTML code whereas other browser seem to behave more tolerant to inplausible parameters… 😉

  3. Addendum: The “cut triangle icon case” seems to be an issue of the plugin’s own color schemes: The problem does *not* show up when I switch to the “WordPress Classic” theme with its more generous spacing between the dropdown menues…

  4. zonebattler on February 6th, 2009 at 3:51 AM wrote:

    Well, if you can live with the CSS issue, so will I!

    No, it was fixed in v3.1.3. 😉

    zonebattler on February 6th, 2009 at 3:51 AM wrote:

    And about the arrow icon being cut in half by Opera: it seems to be a spacing and/or padding issue. Are there any tables involved with fixed cell width? Opera is renowned to be quite precise (if not stubborn) in interpreting HTML code whereas other browser seem to behave more tolerant to inplausible parameters… 😉

    No, the entire admin bar is an unordered list with inline list items.

  5. Addendum 2: Fixing the CSS issue of not indented sub-items

    Adding the lines:


    .wpabar_toplevel ul li {
    padding-left :25px;
    }

    in the wp-admin.css does the trick! (courtesy of Lexikaliker)

  6. Viper! I just tried this for the first time and it’s blowing my mind. I’ve minimized the sidbear in the admin and might never need it again, your plugin is better!

    That said, I have a huge site with hundreds of users and I need to be able to control the defaults to hide the mostly useless items like ‘tools’. Looking at your code I can see that you built in the concepts of $this->defaults[‘hide’] for this purpose but never got around to building an admin UI to populate the list. Luckily I hate the idea of building a UI as much as you. If someone has enough users to need this feature they should know how to call a hook!

    So I think you should just add a filter on the $this->defaults array like you do so people can add themes. Here’s the code to add the filter, just like for themes:

    // Create the default settings and filter it so plugins can add defaults
    $this->defaults = apply_filters('wpbar_defaults', array(
    		'show_site' => '1',
    		'show_admin' => '0',
    		'theme' => $themekeys[0],
    		'hide' => array()
    		)
    	);

    And here’s an example of how simple it would be to use the filter for controlling defaults:

    function gv_add_wpbar_defaults($defaults) {
    		$pages_to_hide = array (
    			'upload.php' => array('0' => 1),
    			'tools.php' => array('0' => 1)
    		);
    		$defaults['hide'] = $pages_to_hide;
    		return $defaults;
    }
    add_filter( 'wpbar_defaults', 'gv_add_wpbar_defaults' );

    IMHO this is the best way forward for your plugin. Keeps it light while also making the functionality fairly simple for those who really need it.

    It’s a lot to ask but if you dont’ want to include this could you possibly drop me an email so I can figure something else out? I’m sure I can control the defaults in a hackier way by hooking into get/save options but if I can depend on this going into the next version of the plugin it would save me and eveyrone else a lot of time 🙂

  7. zonebattler on February 8th, 2009 at 11:48 PM wrote:

    Actually, it wasn’t. But never mind, the solution I found works fine! Thank you nevertheless for your quick support.

    Works fine for me. Opera must be being horrible once again. 😉 I’ll fiddle with how I do the indenting in the next version.

    Jeremy Clarke on February 9th, 2009 at 10:25 AM wrote:

    So I think you should just add a filter on the $this->defaults array like you do so people can add themes.

    I was thinking I did have a filter. I’ll double check and add one if not. 🙂

  8. Hello,

    first of all – thanks for this work.

    My suggestion is to make the admin bar only availabe for admins. I think the best ist to configure this with a CheckBox.

    Thanks and regards
    Gernot
    Germany

  9. I think its a pretty useful idea, though rather than making it a checkbox for ‘show only to admin’ it would be cool if it was a pulldown with several different capabilities and you keyed it on that. Like
    “only show admin bar to users who can [read | edit_posts | publish_posts | manage_options]”

    That way people could hide it from just subscribers but not authors (and obviously it should be keyed to a capability like manage_options rather than a role, because roles are always optional/user defined)

    I bet you could also use the $this->defaults filter to just remove all pages from any user that isn’t an admin, but that’s not really a full solution (cause they could add it themselves after).

  10. mercime on March 19th, 2009 at 3:09 AM wrote:

    I was dismayed when your admin bar which worked very well across all blogs for all users in previous WPMU got limited to site admin only when it was incorporated in WPMU core in 2.7

    My plugin and the version you find in WPMU have gone their seperate ways. My plugin only shows up on WPMU blogs which you have access to. Donncha however is working on making it work more like WordPress.com.

  11. I love your plugin sh@#. AWESOME STUFF. WP Admin Bar concern. I use a plugin named WP125 that manages 125×125 ads. The navigation works fine in the side nav on WP admin pages. It also shows up and works fine in your plugin except for the “Manage” link. Some how it gets fouled up. WP125 uses a strange link to get to the “Manage” portion of it’s plugin: /wp-admin?page=wp125/wp125.php (the ‘/’ may be causing the issue). Not a huge concern as I have another link to get to the ‘Manage’ page via the admin but wanted to run it by you to see if there was a quick fix. The other links use a more traditional link: /wp-admin?page=wp125_settings. This causes no issue with your Admin Bar.

    Again love your work. You are a ‘WordPress Star’ in my book.

  12. My plugin works fine with plugins that use script.php?page=plugin/plugin.php. I use a plugin or two that does that with no issues.

    If a plugin isn’t working with my plugin, then it’s a very good chance that the other plugin is at fault.

  13. Pingback: THE Wordpress Shortcut Tip of the Decade - It’s Almost Hidden | uber.la

  14. Great news. I am sure it is the other authors issue. Do you know of an example plugin that uses the: /wp-admin?page=wp125/wp125.php structure? (besides WP125 of course). I would like to use it as a model to fix WP125. Then I could pass the code on to the WP125 author. I checked all my plugins and none of them call the /wp-admin?page= with a slash in the value. Any help would be appreciated.

    Again love your plugins.

  15. I want to control what other users see. As an example, I don’t want any users except the admin to see comments or tools. Is there a way to control that?

  16. Viper007Bond on March 31st, 2009 at 10:10 PM wrote:

    It goes off normal permissions. Only users who can see the “Tools” menu in the admin area can see it in the admin bar, i.e. admins only.

    I’ve found that the tools menu especially can be really annoying, because if even one of your plugins has an author-accessible menu item under tools (including anything previously under Manage that hasn’t been recoded) all users end up seeing the tools menu. The ‘options’ menu also shows up with only one option ‘admin bar’…

    This is the main reason I asked for that patch to allow filtering of the $defaults array, so I could hide the boring ones by default so that the menu isn’t overloaded with stuff (my site is thinner than the default admin bar, meaning the extra menu items bust down into my layout).

    TwisterMc: Check out my earlier comment about filtering the defaults if you want to hide certain sections by default. Your users will still be able to edit their options to show the menu but they will be off by default. Another avenue to investigate would be installing the Role Manager plugin and trying to limit visibility that way. Just create a dummy author account and log in as it to see how things work.

    Viper007: Any chance that the admin bar options could be moved into the users/profile menu instead of options? Where it is now seems to me to indicate that it is a global option that would affect all users, rather than a personal setting (like visual editor, which is under profile). It would mean that pretty much all non-admins would have one less menu item all the time.

  17. jeremyclarke on April 1st, 2009 at 7:51 AM wrote:

    I’ve found that the tools menu especially can be really annoying, because…

    I can’t control other plugins and where they put their menus. 😉

    jeremyclarke on April 1st, 2009 at 7:51 AM wrote:

    This is the main reason I asked for that patch to allow filtering of the $defaults array

    Yes, I need to do this. However you can also just use the wpabar_menuitems filter to completely remove menu rather than just making it hidden by default.

    TwisterMc: Check out my earlier comment about filtering the defaults if you want to hide certain sections by default. Your users will still be able to edit their options to show the menu but they will be off by default. Another avenue to investigate would be installing the Role Manager plugin and trying to limit visibility that way. Just create a dummy author account and log in as it to see how things work.

    jeremyclarke on April 1st, 2009 at 7:51 AM wrote:

    Any chance that the admin bar options could be moved into the users/profile menu instead of options? Where it is now seems to me to indicate that it is a global option that would affect all users, rather than a personal setting (like visual editor, which is under profile). It would mean that pretty much all non-admins would have one less menu item all the time.

    That is a very good idea.

  18. The new 2.7.2 + Nextgen have a problem in the admin bar…

    If you go to Gallery–> Overview — Dosent work…
    But if you go to the “normal” admin control the “Overview” works.
    This is a minor thing but maybee you could fix it in the new release
    Thanks for a wounderfull Plugin.!!!!

  19. I can confirm the bug reported by Casperse. I have exactly the same issue with my SermonBrowser plugin. It seems that plugins that create their own menu page (not just a submenu) cause the bug, which gives the wrong URL for the first submenu item.

  20. Important suggestion!

    You should enable for admin to customize what other user types have in the bar.

    Just like all the settings in the screenshot (where it says “everything here applies to your account only.”) but instead should be editable for each user type.

    What do you think? Thanks! -Joe

  21. Hi,
    this is a very nice plugin, but i have a question…
    how can I add the menue into a widget or a other place of my website.
    I want to get the plugin so that it shows on a other place like the place from the widgets.
    I need a code, to include the plugin into other places…

    thanks for the plugin and your help… sorry for my bad english… german 😉
    have a nice day
    hella

  22. Is it possible to still show the list of blogs available to the user from a drop down menu? The new “My Blogs” page is now showing up in the dropdown ever since upgrading to WordPress MU 2.7.1. I would like to show all of the available blogs for that user instead.

    Thanks!

  23. I haven’t ported over any of the changes made by the WPMU guys.

    As for WPMU-specific features, I honestly don’t have the motivation, time, or WPMU experience to do it. I happily accept patches though! 🙂

  24. Can I make a request to make the plugin compatible with the Gengo plugin? Gengo is a multilingual plugin that changes the WP language on demand. It obviously needs to hook in as early as possible, so hooks into plugins_loaded. Unfortunately it breaks if other plugins call load_plugin_textdomain before Gengo has loaded, and this plugin therefore breaks it. Could you move your call to load_plugin_textdomain to the init action? You obviously don’t need to output any text until after init. Thanks.

  25. Hi, I have recently found and this plugin and looks indeed great. Very useful.
    However, while it works fine on a new blog I am working on, I’ve noticed that the HMTL/JavaScript used by Admin Bar is outputted twice in the HTML generated for a page. I have installed a number of other plugins, so I was wondering if this is something others have noticed with Admin Bar and whether or not this weird behaviour might depend on a conflict or something with other plugins?
    Thanks

  26. On WPMU 2.7.1, I was getting a ‘max redirect exceed limit’ error when trying to move between backends using the Dashboard Menu dropdown. It may be something with the way that my sites are set up with Domain Mapping but changing

    “admin_url( $url )” to just “( $url )” in line 422

    did the trick. Now all URLs in the bar are relative with no looping. Works great!

    BTW, I thought I was going batty when the Admin Bar disappeared one day and I thought I’d screwed up somewhere. Didn’t occur to me that the update from 2.7 to 2.7.1 may have done it. Glad I found this. Thanks.

  27. great plugin.

    would be great to add the option to hide the “old” menu and the “wphead” cause this is “duplicate content” …

    thanks !

  28. Viper007Bond on May 7th, 2009 at 2:00 AM wrote:

    [quote comment=”227522″]However, while it works fine on a new blog I am working on, I’ve noticed that the HMTL/JavaScript used by Admin Bar is outputted twice in the HTML generated for a page.

    Try the default theme. Your theme must have the hooks twice or something.[/quote]

    I am using Thesis Theme. Are there any known issues with this them?

  29. Viper007Bond on May 7th, 2009 at 2:02 AM wrote:

    The version included in WPMU is a fork of my plugin. You’ll need to file bug reports on the WPMU Trac: http://trac.mu.wordpress.org/

    I know. But I’m in 2.7.1 and am using your plugin to get it back. However, today I found that in restoring the site-wide plugin activation capability, that was removed by a theme editor plugin that had its own mu.php, and reverting back to the 2.7.1 mu.php, the individual blog backend choices in the Dashboard drop-down menu no longer appear. Additionally, clicking on “My Blogs” in that menu now returns:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘blogs.php’ was given in /usr/www/users/[username]/wpmu/wp-includes/plugin.php on line 339

    And it was working so well…

  30. @Viper007: I’m afraid the change you made in 3.1.5 doesn’t fix the problem with Gengo. Multi-lingual filters are necessarily complicated. If you call load_plugin_textdomain on plugins_loaded (even at a later priority), it means that locale can’t be filtered, which is necessary when multilingual plugins are used. Following a discussion on Trac, Ryan Boren said “Plugins that load their textdomain before init is complete are broken”. Could you therefore move load_plugin_textdomain to init?

    http://core.trac.wordpress.org/ticket/1175#comment:14

  31. Just upgraded to MU 2.7.1 and installed this restore the admin bar but now I get and error when selecting ‘my blogs’:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘blogs.php’ was given in /usr/www/users/[username]/wpmu/wp-includes/plugin.php on line 339

    How can I fix this please?

    I’ll have to disable for the moment but doing that defeats the object somewhat.

    Many Thanks

  32. Can you post what you did so I can fix myself please?

    Not your fault but I had no idea 2.7.1 would screw up the admin bar so you plugin was a life saver. I’m in big trouble as most users on our blogs will be totally bemused wondering what’s happened to the navigation. They’ll click the ‘my blog’ link and get even more confused by the PHP error. If there’s a way to turn off ‘my blogs’ on the top admin bar globally for MU I’d appreciate knowing what that is, or failing that if I can have the code to fix it myself.

    I can send an email to all contributors, but if there’s another way to make the transition seamless please let me know

    many thanks

Comments are closed.