[wp-trac] [WordPress Trac] #55748: wp_query post_type taxonomies doesn't accept array in url if hierarchical

WordPress Trac noreply at wordpress.org
Tue May 17 13:53:10 UTC 2022


#55748: wp_query post_type taxonomies doesn't accept array in url if hierarchical
--------------------------+-----------------------------
 Reporter:  dg12345       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  5.9.3
 Severity:  minor         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 if you put the custom taxonomy in the url with an array value
 i.e. ?custom_tax[]=term-1&custom_tax[]=term-2
 it should filter by those terms

 however if you look at the code for wp_query if the taxonomy is
 hierarchical it is put through  wp_basename which cannot process arrays
 and so the input is completely lost

 https://github.com/WordPress/WordPress/blob/102004b50565c767390328aef2357a235d60b026
 /wp-includes/class-wp-query.php#L1131-L1151

 to resolve either we need to move the if(is_array()) above the wp_basename
 if or make wp_basename accept arrays

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55748>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list