Changeset 56925 for trunk/src/wp-includes/class-wp-query.php
- Timestamp:
- 10/12/2023 11:39:05 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r56815 r56925 3193 3193 _prime_post_parent_id_caches( $post_ids ); 3194 3194 3195 $post_parent_cache_keys = array(); 3196 foreach ( $post_ids as $post_id ) { 3197 $post_parent_cache_keys[] = 'post_parent:' . (string) $post_id; 3198 } 3199 3195 3200 /** @var int[] */ 3196 $post_parents = wp_cache_get_multiple( $post_ ids, 'post_parent' );3197 3198 foreach ( $post_parents as $ id=> $post_parent ) {3201 $post_parents = wp_cache_get_multiple( $post_parent_cache_keys, 'posts' ); 3202 3203 foreach ( $post_parents as $cache_key => $post_parent ) { 3199 3204 $obj = new stdClass(); 3200 $obj->ID = (int) $id;3205 $obj->ID = (int) str_replace( 'post_parent:', '', $cache_key ); 3201 3206 $obj->post_parent = (int) $post_parent; 3202 3207 … … 3246 3251 3247 3252 /** @var int[] */ 3248 $post_parents = array(); 3249 $post_ids = array(); 3253 $post_parents = array(); 3254 $post_ids = array(); 3255 $post_parents_cache = array(); 3250 3256 3251 3257 foreach ( $this->posts as $key => $post ) { … … 3255 3261 $post_parents[ (int) $post->ID ] = (int) $post->post_parent; 3256 3262 $post_ids[] = (int) $post->ID; 3263 3264 $post_parents_cache[ 'post_parent:' . (string) $post->ID ] = (int) $post->post_parent; 3257 3265 } 3258 3266 // Prime post parent caches, so that on second run, there is not another database query. 3259 wp_cache_add_multiple( $post_parents , 'post_parent' );3267 wp_cache_add_multiple( $post_parents_cache, 'posts' ); 3260 3268 3261 3269 if ( $q['cache_results'] && $id_query_is_cacheable ) {
Note: See TracChangeset
for help on using the changeset viewer.