Wordpress - How do I remove the admin bar (styling) from frontend only?
function hide_admin_bar_from_front_end(){
if (is_blog_admin()) {
return true;
}
return false;
}
add_filter( 'show_admin_bar', 'hide_admin_bar_from_front_end' );
Edit:
As @Walf suggested in the comments, this could be writen as:
add_filter('show_admin_bar', 'is_blog_admin');
f you want to remove the admin bar (toolbar) AND the bump CSS from your page, use this:
function wpse_99333_hide_admin_bar_from_front_end(){
if ( is_blog_admin() ) {
return true;
}
remove_action( 'wp_head', '_admin_bar_bump_cb' );
return false;
}
add_filter( 'show_admin_bar', 'wpse_99333_hide_admin_bar_from_front_end' );
The _admin_bar_bump_cb
function is the one that inserts the CSS (located in wp-includes/admin-bar.php)