Remove WordPress Admin Bar

Disable the WordPress Admin Bar for all Users and Visitors

1
2
3
4
/*
 * Disable the WordPress Admin Bar for all Users and Visitors
 */
remove_action( 'init', '_wp_admin_bar_init' );

Enable the WordPress Admin Bar for admins only

1
2
3
4
5
6
/*
 * Enable the WordPress Admin Bar for admins only
 */
if ( !current_user_can( 'manage_options' ) ) {
	remove_action( 'init', '_wp_admin_bar_init' );
}