Opened 15 years ago
Closed 15 years ago
#15363 closed defect (bug) (fixed)
When 'taxonomy' and 'term' are queried, other tax-type query args are ignored.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Query | Keywords: | has-patch |
Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Yeah, that diff renders horribly. The patch is not changing the preg_split line, as it initially appears.