Changeset 59235 for trunk/src/wp-includes/post-thumbnail-template.php
- Timestamp:
- 10/14/2024 10:20:09 PM (19 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/post-thumbnail-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-thumbnail-template.php
r55821 r59235 113 113 $thumb_ids = array(); 114 114 115 /* 116 * $wp_query may contain an array of post objects or post IDs. 117 * 118 * This ensures the cache is primed for all post objects to avoid 119 * `get_post()` calls in `get_the_post_thumbnail()` triggering an 120 * additional database call for each post. 121 */ 122 $parent_post_ids = array(); 115 123 foreach ( $wp_query->posts as $post ) { 116 $id = get_post_thumbnail_id( $post->ID ); 124 if ( $post instanceof WP_Post ) { 125 $parent_post_ids[] = $post->ID; 126 } elseif ( is_int( $post ) ) { 127 $parent_post_ids[] = $post; 128 } 129 } 130 _prime_post_caches( $parent_post_ids, false, true ); 131 132 foreach ( $wp_query->posts as $post ) { 133 $id = get_post_thumbnail_id( $post ); 117 134 if ( $id ) { 118 135 $thumb_ids[] = $id;
Note: See TracChangeset
for help on using the changeset viewer.