Invalidate term query caches when setting or deleting term relationships.
Prior to 4.7, term relationships - as set by `wp_set_object_terms()` or `wp_remove_object_terms()` - did not affect the term query cache. The introduction of the 'object_ids' parameter in 4.7 means that the query cache must be aware of object-term relationships. As such, the 'last_changed' incrementor is now invalidated when term relationships are modified. This bug only reared its head when delaying term counting, because term counting performs its own term query cache invalidation. Props mboynes. Fixes #40306. Built from https://develop.svn.wordpress.org/trunk@40353 git-svn-id: http://core.svn.wordpress.org/trunk@40260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3d4f2f2fea
commit
7102240efe
|
@ -2282,6 +2282,7 @@ function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_cache_delete( $object_id, $taxonomy . '_relationships' );
|
wp_cache_delete( $object_id, $taxonomy . '_relationships' );
|
||||||
|
wp_cache_delete( 'last_changed', 'terms' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires after an object's terms have been set.
|
* Fires after an object's terms have been set.
|
||||||
|
@ -2376,6 +2377,7 @@ function wp_remove_object_terms( $object_id, $terms, $taxonomy ) {
|
||||||
$deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) );
|
$deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) );
|
||||||
|
|
||||||
wp_cache_delete( $object_id, $taxonomy . '_relationships' );
|
wp_cache_delete( $object_id, $taxonomy . '_relationships' );
|
||||||
|
wp_cache_delete( 'last_changed', 'terms' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires immediately after an object-term relationship is deleted.
|
* Fires immediately after an object-term relationship is deleted.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-40352';
|
$wp_version = '4.8-alpha-40353';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue