[wp-trac] [WordPress Trac] #16627: Rewrite query vars are stripped from custom taxonomy page URLs via redirect_canonical()

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 6 16:56:00 UTC 2011


#16627: Rewrite query vars are stripped from custom taxonomy page URLs via
redirect_canonical()
---------------------------+------------------------------
 Reporter:  gnoodl         |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:  3.1
 Severity:  normal         |  Resolution:
 Keywords:                 |
---------------------------+------------------------------
Changes (by emartin24):

 * cc: eric@… (added)


Comment:

 Just discovered this issue on my site as well. In my research, I found a
 few differences that seem to be causing the "issue".

 1) In the code just above what @gnoodl mentioned, in 3.0.5, the following
 code results in a {{{$term_count}}} of {{{0}}}:

 {{{
 $term_count = 0;
 foreach ( array('category__in', 'category__not_in', 'category__and',
 'post__in', 'post__not_in',
 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and') as
 $key )
         $term_count += count($wp_query->query_vars[$key]);
 }}}

 In 3.1, the new code results in a {{{$term_count}}} of {{{1}}}:

 {{{
 $term_count = 0;
 foreach ( $wp_query->tax_query->queries as $tax_query )
         $term_count += count( $tax_query['terms'] );
 }}}

 2) In the {{{if}}} condition that @gnoodl mentioned, 3.0.5 includes a
 check for $redirect['query'], 3.1 does not.

 ----

 In my case, I'm using a custom query variable. Perhaps there is another
 solution to my problem, but it worked in 3.0.5 and this is the code that
 causes it to no longer work ;)

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


More information about the wp-trac mailing list