[wp-trac] [WordPress Trac] #57300: parse_tax_query() does not handle array query param when taxonomy has rewrite set to hierarchical

WordPress Trac noreply at wordpress.org
Mon Apr 3 05:42:00 UTC 2023


#57300: parse_tax_query() does not handle array query param when taxonomy has
rewrite set to hierarchical
---------------------------+------------------------------
 Reporter:  chamois_blanc  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Taxonomy       |     Version:  6.1.1
 Severity:  major          |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by chamois_blanc):

 Here is a diff of a possible fix:

 {{{#!php
 <?php
         // Comment out this code
         // if ( ! empty( $t->rewrite['hierarchical'] ) ) {
         //  $q[ $t->query_var ] = wp_basename( $q[ $t->query_var ] );
         // }

         $term = $q[ $t->query_var ];

         // BEGIN - Add this code
         if ( ! empty( $t->rewrite['hierarchical'] ) ) {
           if ( is_array( $term ) ) {
             foreach ( $term as $k => $v ) {
               $term[$k] = wp_basename( $v );
             }
           } else {
             $term = wp_basename( $term );
           }
         }
         // END
 }}}

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


More information about the wp-trac mailing list