Make WordPress Core


Ignore:
Timestamp:
10/03/2015 09:18:55 PM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy-functions.php

    r34811 r34812  
    43914391
    43924392    $object_terms = get_object_term_cache( $object_id, $taxonomy );
    4393     if ( false === $object_terms )
    4394          $object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) );
     4393    if ( false === $object_terms ) {
     4394        $object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) );
     4395        wp_cache_set( $object_id, $object_terms, "{$taxonomy}_relationships" );
     4396    }
    43954397
    43964398    if ( is_wp_error( $object_terms ) )
Note: See TracChangeset for help on using the changeset viewer.