[wp-trac] [WordPress Trac] #54125: Rest API tax_relation=OR doesn't seem to work correctly
    WordPress Trac 
    noreply at wordpress.org
       
    Wed Sep 15 07:02:38 UTC 2021
    
    
  
#54125: Rest API tax_relation=OR doesn't seem to work correctly
--------------------------+-----------------------------
 Reporter:  roverlap      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  5.8
 Severity:  major         |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 Let's say we have posts of a custom post type.
 Post 1 has custom-tax1 with ID1 and custom-tax2 with ID2.
 Post 2 has custom-tax2 with ID2.
 Post 3 has custom-tax1 with ID3.
 Post 4 has no custom taxonomies attached.
 When querying
 {{{
 /wp/v2/custompost?&_fields=id,title&custom-tax1=ID&custom-tax2=ID2
 }}}
 it returns only Post 1 as expected.
 {{{
 /wp/v2/custompost?&_fields=id,title&custom-tax2=ID2
 }}}
 returns Post 1 and Post 2 as expected
 Querying
 {{{
 /wp/v2/custompost?&_fields=id,title&custom-tax1=ID1&custom-
 tax2=ID2&tax_relation=OR
 }}}
 I expect it to return Post 1 and Post 2 as well, but instead it returns
 all 4 Posts. As soon as tax_relation=OR is added to the query, it seems
 all prior tax queries are just ignored.
 Unless I'm misreading this https://make.wordpress.org/core/2020/02/29
 /rest-api-changes-in-5-4/ and it should somehow work differently.
-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54125>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
    
    
More information about the wp-trac
mailing list