Make WordPress Core


Ignore:
Timestamp:
05/26/2016 04:49:10 AM (8 years ago)
Author:
boonebgorges
Message:

Store only term IDs in object term relationships caches.

Previously, objects containing all data about a term were stored in each
object's term cache. Besides being wasteful, this approach caused invalidation
issues, as when a modified term count required a flush for all objects
belonging to the term.

Backward compatibility is maintained for plugins that continue to put object
data directly into the {$taxonomy}_relationships cache bucket.

Fixes #36814.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r37545 r37573  
    312312            if ( false === $terms ) {
    313313                $terms = wp_get_object_terms( $post->ID, $taxonomy_name );
    314                 wp_cache_add( $post->ID, $terms, $taxonomy_name . '_relationships' );
     314                wp_cache_add( $post->ID, wp_list_pluck( $terms, 'term_id' ), $taxonomy_name . '_relationships' );
    315315            }
    316316            $term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' );
Note: See TracChangeset for help on using the changeset viewer.