ControlledChaos
5/7/2015 - 9:01 AM

Disable the WordPress admin bar for certain user roles.

Disable the WordPress admin bar for certain user roles.

<?php

function ccd_hide_admin_bar() {
  // Choose your user role
  if ( ! current_user_can( 'edit_posts' ) ) {
    show_admin_bar(false);
  }
}
add_action( 'set_current_user', 'ccd_hide_admin_bar' );

?>

Disable Admin Bar by User Role

WordPress Snippet