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

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 22 13:31:45 UTC 2011


#18747: Custom Taxonomy Search/Filter Bug
--------------------------------------+------------------------------
 Reporter:  wordpressplugindeveloper  |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Query                     |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:                            |
--------------------------------------+------------------------------
Changes (by scribu):

 * component:  General => Query


Old description:

> First of all, I'm really sorry for my previous fake report.
> This time, I have done enough search and test, and I can't find out a
> solution.
> I'm using fresh 3.2.1 installation for testing this plugin.
> http://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-
> filter-to-admin-list-for-a-custom-post-type/3215
> https://gist.github.com/541505
>
> public param value is true.
> exclude_from_search is false
>
> However, it doesn't work so I have to  trace the wordpress source code.
> Here is what I find in the 177th line in wp-includes/query.php.
>
> $tax_query[] = array(
>                                 'taxonomy' => 'category',
>                                 ******
>                         );
>
> then,
>
> $this->tax_query = new WP_Tax_Query( $tax_query );
>
> in the 2199th line,
> $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
>
> WP_Tax_Query is in wp-includes/taxonomy.php
>
> get_sql  -> clean_query -> transform_query invokes sql operation
>
> SELECT $wpdb->term_taxonomy.******* WHERE taxonomy = 'query['taxonomy']'
> AND *****
>
> however, the  'query['taxonomy']' is 'category' which was hardcoded in
> the 177th line in wp-includes/query.php.
>
> Is this a bug?

New description:

 First of all, I'm really sorry for my previous fake report.
 This time, I have done enough search and test, and I can't find out a
 solution.
 I'm using fresh 3.2.1 installation for testing this plugin.

 http://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-filter-
 to-admin-list-for-a-custom-post-type/3215

 https://gist.github.com/541505

 public param value is true.
 exclude_from_search is false

 However, it doesn't work so I have to  trace the wordpress source code.
 Here is what I find in the 177th line in wp-includes/query.php.


 {{{
 $tax_query[] = array(
         'taxonomy' => 'category',
         ******
 );
 }}}


 then,

 $this->tax_query = new WP_Tax_Query( $tax_query );

 in the 2199th line,

 {{{
 $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
 }}}

 WP_Tax_Query is in wp-includes/taxonomy.php

 get_sql  -> clean_query -> transform_query invokes sql operation


 {{{
 SELECT $wpdb->term_taxonomy.******* WHERE taxonomy = 'query['taxonomy']'
 AND *****
 }}}

 however, the  {{{'query['taxonomy']'}}} is 'category' which was hardcoded
 in the 177th line in wp-includes/query.php.

 Is this a bug?

--

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


More information about the wp-trac mailing list