I’m using wordpress multiste 3.3.1
I’m not gonna update it in the future. So I disabled all upgrade functions.
I want to remove the wordpress admin bar from both frontend as well as dashboard.
I can remove it from frontend using this code.
add_action( 'init', 'disable_admin_bar', 1 );
function disable_admin_bar() {
add_filter( 'show_admin_bar', '__return_false' );
}
But i couldn’t find any solution to remove it from dashboard.
I don’t want to use css solution to hide admin bar
and I’m ready to edit the core files to remove it
Can anyone help me to remove it completely?. Thanks
if (!function_exists('disableAdminBar')) {
function disableAdminBar(){
remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
function remove_admin_bar_style_backend() {
echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
}
add_filter('admin_head','remove_admin_bar_style_backend');
}
}
add_filter('admin_head','remove_admin_bar_style_backend');
Source: http://wp.tutsplus.com/tutorials/how-to-disable-the-admin-bar-in-wordpress-3-3/
OR, for both front and back end…
if (!function_exists('disableAdminBar')) {
function disableAdminBar(){
remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 ); // for the admin page
remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); // for the front end
function remove_admin_bar_style_backend() { // css override for the admin page
echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
}
add_filter('admin_head','remove_admin_bar_style_backend');
function remove_admin_bar_style_frontend() { // css override for the frontend
echo '<style type="text/css" media="screen">
html { margin-top: 0px !important; }
* html body { margin-top: 0px !important; }
</style>';
}
add_filter('wp_head','remove_admin_bar_style_frontend', 99);
}
}
// add_filter('admin_head','remove_admin_bar_style_backend'); // Original version
add_action('init','disableAdminBar'); // New version
THat looks like it should do it…. May I go on record as saying that planning to never update WordPress is a terrible idea. If nothing else, for security reasons.
Some CSS is required in there, or else you end up with a big gap where the bar used to be. NOTE: I’ve not tested this, as I have no need. But that source is normally quite reliable.