I am trying to move the WP Admin bar on the front end to below my themes main header navigation, as well as make it the same width.

I am using the GeneratePress theme and am getting support from them to achieve this, however we’re stuck.

Here’s what they said, “ I just dug through the core WordPress code for the admin bar hoping to find a way to unhook the current position and move it somewhere else, but I came up empty.

Basically, we need to unhook the bar from the current position and hook it into a different action.”

Any ideas on how to achieve this?


1 Answer 1


The admin bar is hooked to wp_footer. So …

remove_action( 'wp_footer', 'wp_admin_bar_render', 0 );

… will remove it from there. And then you can register it for a custom hook with:

add_action( 'my_custom_hook', 'wp_admin_bar_render', 1000 );

You still have to overwrite the CSS in your stylesheet, but that should be fairly simple.

Oh, and welcome to WordPress Stack Exchange! :)

  • Thank you. I am still unfortunately not able to get it to work. This is the code that the theme developer gave me to try: remove_action( 'wp_footer', 'wp_admin_bar_render', 0 ); add_action( 'generate_after_header', 'wp_admin_bar_render', 20 ); When I put it in my themes functions.php file. It does nothing. It doesn't even remove the WP Bar. However, when I use this code: function hide_admin_bar(){ return false; } add_filter( 'show_admin_bar', 'hide_admin_bar' ); It successfully removes the WP bar. Now I need to find a way to add the WP bar below the theme's header. Any ideas? Feb 25, 2020 at 23:02
  • 2
    Did you read the full answer? You need to also override its CSS so that it doesn't float. Feb 26, 2020 at 3:35
  • as far as I understand, the adminbar gets loaded via jQuery into its location just inside the body tag; unhooking the function from 'wp_footer' and hooking it into a different location within the theme would not change that. using just CSS to change from 'fixed' to 'absolute' and to new coordinates would be quite challenging in a responsive theme.
    – Michael
    Feb 26, 2020 at 4:54

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.