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

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 22 14:08:21 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):

 I hijack the parse_query and try to add taxonomy parm with custom
 taxonomy.


 $tax_query[] = array(
                                 'taxonomy' => 'category',
 )

 however, as you can see, the $tax_query is an array. So two array then.
 That one I hijicak is correct and the other one is generated by the 1745th
 line.

 WP_Tax_Query will use  transform_query to get terms data, however, it uses
 the term_id to get terms data from category taxonomy.  You know, it
 returns nothing.

 these code below is part of get_sql.
 foreach ( $this->queries as $query ) {

 ........................
                                 if ( empty( $terms ) ) {
                                         if ( 'OR' == $this->relation )
                                                 continue;
                                         else
                                                 return self::$no_results;
                                 }
 .............
 }

 Can you see?  the terms is absolutely empty because the term_id in
 category taxonomy didn't exists.

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


More information about the wp-trac mailing list