WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#22394 closed defect (bug) (fixed)

is_object_in_term always returning false

Reported by: picklewagon Owned by:
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

Doing a lookup using is_object_in_term is always returning false. If the object terms it will return the terms correctly. The check to see if the cache lookup was successful always fails. The wrong object is being used to verify the cache lookup.

Here is the current code:

$object_terms = get_object_term_cache( $object_id, $taxonomy );
if ( false === $terms )
       $object_terms = wp_get_object_terms( $object_id, $taxonomy );

$terms is a parameter passed to the function. The code should be changed to:

$object_terms = get_object_term_cache( $object_id, $taxonomy );
if ( false === $object_terms )
       $object_terms = wp_get_object_terms( $object_id, $taxonomy );

Attachments (1)

is_object_in_term.patch (480 bytes) - added by picklewagon 6 years ago.

Download all attachments as: .zip

Change History (2)

#1 @nacin
6 years ago

  • Component changed from General to Taxonomy
  • Milestone changed from Awaiting Review to 3.5
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.