Changeset 36566 for trunk/src/wp-includes/post.php
- Timestamp:
- 02/17/2016 10:57:33 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r36498 r36566 5949 5949 5950 5950 /** 5951 * Queue posts for lazyloading of term meta. 5952 * 5953 * @since 4.5.0 5954 * 5955 * @param array $posts Array of WP_Post objects. 5956 */ 5957 function wp_queue_posts_for_term_meta_lazyload( $posts ) { 5958 $post_type_taxonomies = $term_ids = array(); 5959 foreach ( $posts as $post ) { 5960 if ( ! ( $post instanceof WP_Post ) ) { 5961 continue; 5962 } 5963 5964 if ( ! isset( $post_type_taxonomies[ $post->post_type ] ) ) { 5965 $post_type_taxonomies[ $post->post_type ] = get_object_taxonomies( $post->post_type ); 5966 } 5967 5968 foreach ( $post_type_taxonomies[ $post->post_type ] as $taxonomy ) { 5969 // Term cache should already be primed by `update_post_term_cache()`. 5970 $terms = get_object_term_cache( $post->ID, $taxonomy ); 5971 if ( false !== $terms ) { 5972 foreach ( $terms as $term ) { 5973 if ( ! isset( $term_ids[ $term->term_id ] ) ) { 5974 $term_ids[] = $term->term_id; 5975 } 5976 } 5977 } 5978 } 5979 } 5980 5981 if ( $term_ids ) { 5982 $lazyloader = wp_metadata_lazyloader(); 5983 $lazyloader->queue_objects( 'term', $term_ids ); 5984 } 5985 } 5986 5987 /** 5951 5988 * Update the custom taxonomies' term counts when a post's status is changed. 5952 5989 *
Note: See TracChangeset
for help on using the changeset viewer.