How to disable the wordpress admin bar for admin only specific users etc

Recently i needed to remove the admin bar for one of our websites i love wordpress but the admin bar always seems to get in the way.

Add to functions.php


function hide_admin_bar_settings() {
?>
	<style type="text/css">
		.show-admin-bar {
			display: none;
		}
	</style>
<?php
}

function disable_admin_bar() {
    add_filter( 'show_admin_bar', '__return_false' );
    add_action( 'admin_print_scripts-profile.php',
         'hide_admin_bar_settings' );
}
add_action( 'init', 'disable_admin_bar' , 9 );

Allow for one user and disable for everyone else


function hide_admin_bar_settings() {
?>
	<style type="text/css">
		.show-admin-bar {
			display: none;
		}
	</style>
<?php
}

function disable_admin_bar() {
   if ( 2 != get_current_user_id() ) {
      add_filter( 'show_admin_bar', '__return_false' );
      add_action( 'admin_print_scripts-profile.php',
          'hide_admin_bar_settings' );
   }
}
add_action( 'init', 'disable_admin_bar' , 9 );