[wp-trac] [WordPress Trac] #15363: When 'taxonomy' and 'term' are queried, other tax-type query args are ignored.

WordPress Trac wp-trac at lists.automattic.com
Tue Nov 9 16:18:21 UTC 2010


#15363: When 'taxonomy' and 'term' are queried, other tax-type query args are
ignored.
--------------------------+-------------------------------------------------
 Reporter:  filosofo      |       Owner:           
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  3.1      
Component:  Query         |     Version:  3.1      
 Severity:  normal        |    Keywords:  has-patch
--------------------------+-------------------------------------------------
 == Steps to Reproduce ==
 The following is the content of a simple page template.  Assign it to a
 page and view that page.

 page template content:
 {{{
 <?php

 /*
 Template Name: Test Template
 */

 // note that below you will need to replace "a tag" and "a category name"
 with actual tag and category properties.
 $query_args = array(
         'taxonomy' => 'post_tag',
         'term' => 'a tag',
         'category_name' => 'a category name',
 );

 echo 'query args:';
 var_dump( $query_args );

 query_posts( $query_args );

 echo '<ul>';
 while (have_posts() ) :
         the_post();
         echo '<li>';
                 the_title();
                 echo 'tags: ' . get_the_tag_list( '', ', ' );
                 echo 'categories: ' . get_the_category_list( '', ', ' );
         echo '</li>';
 endwhile;
 echo '</ul>';

 }}}

 == Problem ==
 In WordPress 3.0, the result prints the posts that are assigned both the
 tag and the category.

 In trunk, the result prints the posts that are assigned the tag; the
 category name query parameter is ignored.

 == Solution ==
 Patch allows ''both'' the use of a mixture of taxonomy query arguments.

 It's not clear from the diff, but it's basically just moving the foreach
 wp_taxonomies loop out of the scope of the else statement.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15363>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list