Created
January 17, 2013 22:44
-
-
Save norcross/4560556 to your computer and use it in GitHub Desktop.
remove admin bar globally on front and back end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action ( 'init', 'rkv_adminbar_front_kill' ); | |
add_action ( 'admin_init', 'rkv_adminbar_back_kill' ); | |
function rkv_adminbar_front_kill() { | |
show_admin_bar( false ); | |
wp_dequeue_script('admin-bar'); | |
wp_dequeue_style('admin-bar'); | |
add_filter('wp_head', 'rkv_admin_front_style_kill', 99 ); | |
add_filter('admin_head', 'rkv_admin_back_style_kill', 99 ); | |
} | |
function rkv_adminbar_back_kill() { | |
show_admin_bar( false ); | |
wp_dequeue_script('admin-bar'); | |
wp_dequeue_style('admin-bar'); | |
add_filter('admin_head', 'rkv_admin_back_style_kill', 99 ); | |
} | |
function rkv_admin_front_style_kill() { | |
echo '<style type="text/css" media="screen"> | |
html { margin-top: 0px !important; } | |
* html body { margin-top: 0px !important; } | |
</style>'; | |
} | |
function rkv_admin_back_style_kill() { | |
echo '<style type="text/css" media="screen"> | |
html.wp-toolbar { margin-top: 0px !important; padding-top: 0px !important; } | |
div#wpadminbar {display:none!important;} | |
</style>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment