Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
    
I wouldn't recommend removing the admin bar from the admin section especially when running a multi-site setup. The admin bar is where the navigation is now put to navigate between all your sites and get to the network admin. If you remove it you will have to code in your own menu else where or remember all the URLs... –  Brady Feb 2 '12 at 12:48
    
upgrading your wordpress is highly recommanded when new version arrives. It will keep your site secured. –  Sisir Feb 2 '12 at 12:59
    
@Brady I can access the network admin with this url /wp-admin/network/ I can access all my sites from this link /wp-admin/my-sites.php –  Giri Feb 2 '12 at 13:41
6  
"I'm ready to edit the core" sounds like "I'm ready to die for my country". It does a good line in a movie script, I can even see Tom Cruise saying it! ;) –  brasofilo Jan 8 '13 at 17:03
    
@brasofilo ;) ..... –  Giri Jan 12 '13 at 2:28

3 Answers 3

up vote 3 down vote accepted
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.

share|improve this answer

Just remove the action:

remove_action('init', 'wp_admin_bar_init');
share|improve this answer
    
I think the function is _wp_admin_bar_init, with _. –  bueltge Jan 7 '13 at 22:50
    
@bueltge admin-bar.php:39 add_action( 'init', '_wp_admin_bar_init' ); // Don't remove. Wrong way to disable. :) wp_admin_bar_init is viable. –  Brian Fegter Jan 8 '13 at 0:49
    
But I cant find the function wp_admin_bar_init. Have you more hints for to understand this? Thanks. –  bueltge Jan 8 '13 at 16:11

Use this small plugin, also available on Gist: https://gist.github.com/1503172 Works fine and is also a part of the plugin free "Adminimize".

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( 'wp_head', 'admin_head' ) as $hook ) {
        add_action(
            $hook,
            create_function(
                    '',
                    "echo '<style>body.admin-bar, body.admin-bar #wpcontent, body.admin-bar #adminmenu {
                         padding-top: 0px !important;
                    }
                    html.wp-toolbar {
                        padding-top: 0px !important;
                    }</style>';"
            )
        );
    }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.