How can I to add a wrapper class to the WordPress admin bar?

I would like to center the contents to the same width as my theme.

1 Answer 1


There isn't a filter/wrapper for the admin bar CSS that you can plug into , the function is simply

  function wp_admin_bar_header() { ?>
  <style type="text/css" media="print">#wpadminbar { display:none; }</style>

You can over ride the CSS using !important or use jQuery to prepend a class/id to the bar.

Something like:

jQuery("<div id='custom-width'></div>").prependTo("#wpadminbar");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.