WordPress.org

Make WordPress Core

Ticket #13787: 13787.diff

File 13787.diff, 920 bytes (added by ryan, 5 years ago)
  • wp-includes/nav-menu-template.php

     
    162162        if ( $menu && ! is_wp_error($menu) && !isset($menu_items) ) 
    163163                $menu_items = wp_get_nav_menu_items( $menu->term_id ); 
    164164 
    165         // If no menu was found or if the menu has no items, call the fallback_cb if it exists 
    166         if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) ) ) 
     165        // If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists 
     166        if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) ) 
    167167                && ( function_exists($args->fallback_cb) || is_callable( $args->fallback_cb ) ) ) 
    168168                        return call_user_func( $args->fallback_cb, (array) $args ); 
    169169