Update the taxonomy relationship cache in `is_object_in_term()`.
This function attempts to read from the relationship cache, and uses any data it finds. If it finds no data, it does a query for the data it needs. Since we are going to the trouble to query for the relationships, and since we are already using cached data when available, let's go ahead and cache it for later use. Props joehoyle, boonebgorges. Fixes #32044. Built from https://develop.svn.wordpress.org/trunk@34812 git-svn-id: http://core.svn.wordpress.org/trunk@34777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5be41d618f
commit
f08e5c2d80
|
@ -4390,8 +4390,10 @@ function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
|
|||
return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );
|
||||
|
||||
$object_terms = get_object_term_cache( $object_id, $taxonomy );
|
||||
if ( false === $object_terms )
|
||||
if ( false === $object_terms ) {
|
||||
$object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) );
|
||||
wp_cache_set( $object_id, $object_terms, "{$taxonomy}_relationships" );
|
||||
}
|
||||
|
||||
if ( is_wp_error( $object_terms ) )
|
||||
return $object_terms;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-34811';
|
||||
$wp_version = '4.4-alpha-34812';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue