Make WordPress Core

Ticket #20875: 20875-example-usage.diff

File 20875-example-usage.diff, 1.5 KB (added by boonebgorges, 10 years ago)
  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index 4ce2ac1..f67e721 100644
    function wp_delete_auto_drafts() { 
    60296029 */
    60306030function wp_queue_posts_for_term_meta_lazyload( $posts ) {
    60316031        $post_type_taxonomies = $term_ids = array();
     6032        $cache_keys = array();
    60326033        foreach ( $posts as $post ) {
    60336034                if ( ! ( $post instanceof WP_Post ) ) {
    60346035                        continue;
    function wp_queue_posts_for_term_meta_lazyload( $posts ) { 
    60396040                }
    60406041
    60416042                foreach ( $post_type_taxonomies[ $post->post_type ] as $taxonomy ) {
    6042                         // Term cache should already be primed by `update_post_term_cache()`.
    6043                         $terms = get_object_term_cache( $post->ID, $taxonomy );
    6044                         if ( false !== $terms ) {
    6045                                 foreach ( $terms as $term ) {
    6046                                         if ( ! isset( $term_ids[ $term->term_id ] ) ) {
    6047                                                 $term_ids[] = $term->term_id;
    6048                                         }
    6049                                 }
     6043                        if ( ! isset( $cache_keys[ "{$taxonomy}_relationships" ] ) ) {
     6044                                $cache_keys[ "{$taxonomy}_relationships" ] = array();
     6045                        }
     6046
     6047                        // Force uniqueness by overwriting key.
     6048                        $cache_keys[ "{$taxonomy}_relationships" ][ $post->ID ] = $post->ID;
     6049                }
     6050        }
     6051
     6052        if ( ! $cache_keys ) {
     6053                return;
     6054        }
     6055
     6056        $cached_values = wp_cache_get_multi( $cache_keys );
     6057        foreach ( $cached_values as $tax_cache_group => $cached_posts ) {
     6058                foreach ( $cached_posts as $post_id => $cached_post_term_ids ) {
     6059                        if ( false === $cached_post_term_ids ) {
     6060                                continue;
     6061                        }
     6062
     6063                        foreach ( $cached_post_term_ids as $term_id ) {
     6064                                $term_ids[ $term_id ] = $term_id;
    60506065                        }
    60516066                }
    60526067        }