Advertisement
fauzanjeg

Remove Admin Bar / ToolBar for Subscriber

Nov 1st, 2021
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1. /* Remove Admin Bar / ToolBar for Subscriber */
  2. function remove_admin_bar_for_subscriber() {
  3.     $user = wp_get_current_user();
  4.     if ( in_array( 'subscriber', (array) $user->roles ) ) {
  5.         show_admin_bar( false );
  6.     }
  7. }
  8.  
  9. add_action('after_setup_theme', 'remove_admin_bar_for_subscriber');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement