[wp-trac] [WordPress Trac] #31383: Add WP_Tax_Query support to WP_User_Query

WordPress Trac noreply at wordpress.org
Mon Oct 10 20:33:11 UTC 2016


#31383: Add WP_Tax_Query support to WP_User_Query
-----------------------------+-----------------------------
 Reporter:  desrosj          |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  Query            |     Version:  4.2
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+-----------------------------

Comment (by desrosj):

 Incoming updated patch that will apply cleanly to trunk. This patch adds
 taxonomy query support to user queries with no UX. It includes a few new
 unit tests, but since this is the first time writing unit tests, I
 probably missed a bunch.

 While refreshing the patch, I realized that there is one main issue we
 will need to solve in order to make this feature work. Term relationships
 are based on object IDs. But currently, the object ID is always assumed to
 be a post. This is an issue because users can have the same ID as posts
 since they are stored in separate tables. Without addressing this issue,
 taxonomy support for users can not be added for taxonomies that are not
 exclusive to users.

 Example: if there is a post with an ID of 3, and a user with an ID of 3,
 calling `wp_set_object_terms()` will assign the term to both, regardless
 of the intent.

 #38265 was recently opened, and this could be one potential way to fix the
 issue. Not sure if there are any other ideas how to accomplish this
 without altering tables.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31383#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list