Skip to content

Instantly share code, notes, and snippets.

@bueltge
Last active September 28, 2015 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bueltge/1503172 to your computer and use it in GitHub Desktop.
Save bueltge/1503172 to your computer and use it in GitHub Desktop.
Remove Admin Bar in WordPress 3.3
add_action( 'init', 'fb_remove_admin_bar', 0 );
function fb_remove_admin_bar() {
wp_deregister_script( 'admin-bar' );
wp_deregister_style( 'admin-bar' );
remove_action( 'init', '_wp_admin_bar_init' );
remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
// maybe also: 'wp_head'
foreach ( array( 'admin_head' ) as $hook ) {
add_action(
$hook,
create_function(
'',
"echo '<style>body.admin-bar #wpcontent, body.admin-bar
#adminmenu { padding-top: 0px !important; }</style>';"
)
);
}
add_action( 'in_admin_header', '_mw_adminimize_restore_links' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment