WordPress.org

Make WordPress Core

Ticket #27120: 27120.2.patch

File 27120.2.patch, 1006 bytes (added by Clorith, 6 years ago)

Fixed indentations to follow coding standard

  • wp-includes/nav-menu-template.php

     
    250250        }
    251251
    252252        // If the menu exists, get its items.
    253         if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
    254                 $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
     253        if ( $menu && ! is_wp_error( $menu ) && ! isset( $menu_items ) ) {
     254                // Check if we have a cache of this menus items first
     255                $menu_items = wp_cache_get( 'wp_nav_menu_' . $args->theme_location );
     256
     257                // If no cache exists for this menu, fetch it and set the cache in case of repeat use
     258                if ( ! $menu_items ) {
     259                        $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
     260                        wp_cache_set( 'wp_nav_menu_' . $args->theme_location, $menu_items );
     261                }
     262        }
    255263
    256264        /*
    257265         * If no menu was found: