[wp-trac] [WordPress Trac] #52468: Filtering posts with multiple tags and tax relation AND returning unexpected results

WordPress Trac noreply at wordpress.org
Mon Feb 8 16:06:42 UTC 2021


#52468: Filtering posts with multiple tags and tax relation AND returning
unexpected results
-------------------------------+------------------------------
 Reporter:  milana_cap         |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  REST API           |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  rest-api
-------------------------------+------------------------------
Changes (by TimothyBlynJacobs):

 * keywords:   => reporter-feedback


Comment:

 Thanks for the ticket @milana_cap!

 I believe this is expected behavior. `tax_relation` is for each
 `tax_query`. A separate `tax_query` is built for each taxonomy query
 parameter. So `tags`, `tags_exclude`, `categories`, `categories_exclude`
 etc... would each be a separate `tax_query`. You could then use
 `tax_relation` to say that the posts must have any of those tags, and any
 of those categories, etc...

 I think what you are looking for is #41287.

 I'm not sure why `?tags=ID&&ID` works, but I wouldn't consider it an
 official API.

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


More information about the wp-trac mailing list