WordPress.org

Make WordPress Core

Opened 14 months ago

#23635 new enhancement

get_objects_in_term - identify matching terms

Reported by: leepowers Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 3.5.1
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:

Description

get_objects_in_term is great for viewing taxonomy relationships for non-posts. However the return value is too limited for certain use cases. For When fetching object_ids for multiple terms the return value doesn't inform as to the matching term.

For instance this query:

$object_ids = get_objects_in_term(array(55, 66, 77, 88, 99), "my_custom_taxonomy"); 

Might return an array of object_ids as follows:

array(101, 202, 303, 404); 

However there's no way to tell which term a particular object_id matched. Did object 101 match term 77? Or maybe it was term 99? Or both?

I've created a modified version of get_objects_in_term which will addresses this issue. I'll submit a patch, but am wondering if there's another way to achieve this functionality.

Change History (0)

Note: See TracTickets for help on using tickets.