'Inherit', 'tag' => 'inherit', ], [ 'name' => 'Hidden', 'tag' => 'hidden', ], [ 'name' => 'Displayed', 'tag' => 'displayed', ], ); } public static function get_icon() { return 'wordpress'; } public static function get_options_type() { return 'dropdown'; } public static function get_option_value( $user_role ) { return get_option( static::get_option_name( $user_role ) ); } public static function show_admin_bar( $show_admin_bar ) { if ( is_user_logged_in() ) { $user_role = reset( wp_get_current_user()->roles ); $visibility = static::get_option_value( $user_role ); switch ( $visibility ) { case 'displayed': $show_admin_bar = true; break; case 'hidden': $show_admin_bar = false; break; default: break; } } return $show_admin_bar; } }