[wp-trac] [WordPress Trac] #18747: Custom Taxonomy Search/Filter Bug

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 23 00:27:54 UTC 2011


#18747: Custom Taxonomy Search/Filter Bug
--------------------------------------+----------------------
 Reporter:  wordpressplugindeveloper  |       Owner:
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:
Component:  Query                     |     Version:
 Severity:  normal                    |  Resolution:  invalid
 Keywords:                            |
--------------------------------------+----------------------

Comment (by wordpressplugindeveloper):

 {{{
 $tax_query_defaults = array(
                                         'taxonomy' => $taxonomy,
                                         'field' => 'slug',
                                 );

                                 if ( isset( $t->rewrite['hierarchical'] )
 && $t->rewrite['hierarchical'] ) {
                                         $q[$t->query_var] = wp_basename(
 $q[$t->query_var] );
                                 }

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

                                 if ( strpos($term, '+') !== false ) {
                                         $terms = preg_split( '/[+]+/',
 $term );
                                         foreach ( $terms as $term ) {
                                                 $tax_query[] =
 array_merge( $tax_query_defaults, array(
                                                         'terms' => array(
 $term )
                                                 ) );
                                         }
                                 } else {

                                         $tax_query[] = array_merge(
 $tax_query_defaults, array(
                                                 'terms' => preg_split(
 '/[,]+/', $term )
                                         ) );

                                 }

 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18747#comment:20>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list