Make WordPress Core

Changeset 22233


Ignore:
Timestamp:
10/15/2012 02:17:50 PM (12 years ago)
Author:
nacin
Message:

Prime post term caches for nav menu items. Avoid doing so in frontend template functions as it remains unneeded there. see #22189.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/nav-menu-template.php

    r22118 r22233  
    156156        $menus = wp_get_nav_menus();
    157157        foreach ( $menus as $menu_maybe ) {
    158             if ( $menu_items = wp_get_nav_menu_items($menu_maybe->term_id) ) {
     158            if ( $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ) ) {
    159159                $menu = $menu_maybe;
    160160                break;
     
    165165    // If the menu exists, get its items.
    166166    if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
    167         $menu_items = wp_get_nav_menu_items( $menu->term_id );
     167        $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
    168168
    169169    /*
  • trunk/wp-includes/nav-menu.php

    r19712 r22233  
    484484
    485485    $defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item',
    486         'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true,
    487         'update_post_term_cache' => false );
     486        'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true );
    488487    $args = wp_parse_args( $args, $defaults );
    489488    if ( count( $items ) > 1 )
Note: See TracChangeset for help on using the changeset viewer.