Changeset 52975
- Timestamp:
- 03/22/2022 09:56:59 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/nav-menu.php
r52332 r52975 717 717 } 718 718 719 // Get all posts and terms at once to prime thecaches.720 if ( empty( $fetched[ $menu->term_id ] ) && ! wp_using_ext_object_cache()) {719 // Prime posts and terms caches. 720 if ( empty( $fetched[ $menu->term_id ] ) ) { 721 721 $fetched[ $menu->term_id ] = true; 722 $post s= array();723 $term s= array();722 $post_ids = array(); 723 $term_ids = array(); 724 724 foreach ( $items as $item ) { 725 725 $object_id = get_post_meta( $item->ID, '_menu_item_object_id', true ); 726 $object = get_post_meta( $item->ID, '_menu_item_object', true );727 726 $type = get_post_meta( $item->ID, '_menu_item_type', true ); 728 727 729 728 if ( 'post_type' === $type ) { 730 $post s[ $object ][] =$object_id;729 $post_ids[] = (int) $object_id; 731 730 } elseif ( 'taxonomy' === $type ) { 732 $term s[ $object ][] =$object_id;731 $term_ids[] = (int) $object_id; 733 732 } 734 733 } 735 734 736 if ( ! empty( $posts ) ) { 737 foreach ( array_keys( $posts ) as $post_type ) { 738 get_posts( 739 array( 740 'post__in' => $posts[ $post_type ], 741 'post_type' => $post_type, 742 'nopaging' => true, 743 'update_post_term_cache' => false, 744 ) 745 ); 746 } 747 } 748 unset( $posts ); 749 750 if ( ! empty( $terms ) ) { 751 foreach ( array_keys( $terms ) as $taxonomy ) { 752 get_terms( 753 array( 754 'taxonomy' => $taxonomy, 755 'include' => $terms[ $taxonomy ], 756 'hierarchical' => false, 757 ) 758 ); 759 } 760 } 761 unset( $terms ); 735 if ( ! empty( $post_ids ) ) { 736 _prime_post_caches( $post_ids, false ); 737 } 738 unset( $post_ids ); 739 740 if ( ! empty( $term_ids ) ) { 741 _prime_term_caches( $term_ids ); 742 } 743 unset( $term_ids ); 762 744 } 763 745
Note: See TracChangeset
for help on using the changeset viewer.