WordPress.org

Make WordPress Core

Ticket #18990: 18990.patch

File 18990.patch, 656 bytes (added by kawauso, 4 years ago)

Check early on for the current site removal conditions

  • wp-includes/admin-bar.php

     
    288288        if ( ! is_user_logged_in() || ! is_multisite() ) 
    289289                return; 
    290290 
     291        $user_blog_count = count( $wp_admin_bar->user->blogs ); 
     292 
    291293        // Show only when there are more than two items in the menu. 
    292         if ( count( $wp_admin_bar->user->blogs ) <= 1 && ! is_super_admin() ) 
     294        if ( ( $user_blog_count <= 1 && ! is_super_admin() ) || ( $user_blog_count <= 2 && ! is_network_admin() && ! is_user_admin() ) ) 
    293295                return; 
    294296 
    295297        $wp_admin_bar->add_menu( array(