[wp-trac] [WordPress Trac] #13582: filtering via post_type + taxonomy does not work properly.
WordPress Trac
wp-trac at lists.automattic.com
Thu May 27 19:08:12 UTC 2010
#13582: filtering via post_type + taxonomy does not work properly.
--------------------------+-------------------------------------------------
Reporter: anointed | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: Post Types | Version: 3.0
Severity: normal | Keywords: post_types, taxonomies
--------------------------+-------------------------------------------------
I have found that 3.0nightly does not allow me to sort via both post_type
and taxonomy term, when the tax term is applied to multiple post_types.
I have a custom taxonomy 'series' registered to 2 separate post_types,
'movies and television'.
Working on creating a custom taxonomy page that will return the results
for only 'movies' with a tax term of 'series' in my file taxonomy-
series.php
Example script:
{{{
$my_query = get_posts( array(
'numberposts' => 5,
'post_type' => 'movies',
'series' => $term->taxonomy
//have also tried in place of series above
'taxonomy' => $term->taxonomy
) );
if( $my_query ) {
print '<h2>Resources</h2>';
foreach( $my_query as $post ) {
setup_postdata( $post );
the_title( '', ' - <b>' . $post->post_type . '</b><br />'
);
the_excerpt();
}
}
}}}
Another example
{{{
<?php
$wpq = array (post_type =>'movies','taxonomy'=>'series';
$query = new WP_Query ($wpq);
while ( have_posts()) : the_post(); ?>
<?php the_title(); ?>
do other stuff
<?php endwhile; ?>
}}}
Basically it seems that no matter what function combination I try, I
always get the results returned containing both movies and television for
the tax series.
The functions do work, when there is only a single post_type with the
taxonomy term. The problems only arise when there is more than one
post_type involved.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13582>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list