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.
Built from https://develop.svn.wordpress.org/trunk@37573
git-svn-id: http://core.svn.wordpress.org/trunk@37541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -311,7 +311,7 @@ function get_inline_data($post) {
|
||||
$terms = get_object_term_cache( $post->ID, $taxonomy_name );
|
||||
if ( false === $terms ) {
|
||||
$terms = wp_get_object_terms( $post->ID, $taxonomy_name );
|
||||
wp_cache_add( $post->ID, $terms, $taxonomy_name . '_relationships' );
|
||||
wp_cache_add( $post->ID, wp_list_pluck( $terms, 'term_id' ), $taxonomy_name . '_relationships' );
|
||||
}
|
||||
$term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user