[wp-trac] [WordPress Trac] #31383: Add WP_Tax_Query support to WP_User_Query
WordPress Trac
noreply at wordpress.org
Thu Feb 19 16:31:16 UTC 2015
#31383: Add WP_Tax_Query support to WP_User_Query
-----------------------------+-----------------------------
Reporter: desrosj | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
Users like any other object type in WordPress can have taxonomy terms
assigned to them. However, there is currently no way to query by
taxonomies in WP_User_Query.
As far as I could find, the only way to really accomplish this right now
is to use get_objects_in_term(), filter out the non user objects, and then
use the include parameter.
Ideally, I think you should be able to accomplish this by the following:
{{{
$user_query = new WP_User_Query( array(
'tax_query' => array(
array(
'taxonomy' => 'tax_name',
'field' => 'slug',
'terms' => array( 'term-1', 'term-2' ),
)
)
) );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31383>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list