Prime post term caches for nav menu items. Avoid doing so in frontend template functions as it remains unneeded there. see #22189.
git-svn-id: http://core.svn.wordpress.org/trunk@22233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2cc408d09c
commit
6c56e0573c
|
@ -155,7 +155,7 @@ function wp_nav_menu( $args = array() ) {
|
|||
if ( ! $menu && !$args->theme_location ) {
|
||||
$menus = wp_get_nav_menus();
|
||||
foreach ( $menus as $menu_maybe ) {
|
||||
if ( $menu_items = wp_get_nav_menu_items($menu_maybe->term_id) ) {
|
||||
if ( $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ) ) {
|
||||
$menu = $menu_maybe;
|
||||
break;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ function wp_nav_menu( $args = array() ) {
|
|||
|
||||
// If the menu exists, get its items.
|
||||
if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
|
||||
$menu_items = wp_get_nav_menu_items( $menu->term_id );
|
||||
$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
|
||||
|
||||
/*
|
||||
* If no menu was found:
|
||||
|
|
|
@ -483,8 +483,7 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
|
|||
return $items;
|
||||
|
||||
$defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item',
|
||||
'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true,
|
||||
'update_post_term_cache' => false );
|
||||
'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true );
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
if ( count( $items ) > 1 )
|
||||
$args['include'] = implode( ',', $items );
|
||||
|
|
Loading…
Reference in New Issue