[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 20:51:55 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
--------------------------+-------------------------------------------------

Comment(by anointed):

 I am trying a variation of the top function you provided.

 When using   'series'=>'xyz' it works

 However, 'xyz' is not known until a person clicks a link to get to the
 page. xyz should be determined via the slug.

 Another example:

 {{{
 <?php
 $args=array(
   'post_type' => 'podcasts',
   'taxonomy' => 'series',
   'term' => $term->slug,
   'post_status' => 'publish',
   'posts_per_page' => -1
 );
 $my_query = null;
 $my_query = new WP_Query($args);
 if( $my_query->have_posts() ) {
   while ($my_query->have_posts()) : $my_query->the_post(); ?>
 //do stuff
 <?php
   endwhile;
 }
 wp_reset_query();
 ?>
 }}}

 maybe an example page would help:
 http://deardaddy.org/series/the-anointing/

 using the function above, the concept is easy.
 I have 2 sets of displays 'sermons, podcasts' both of which use the
 taxonomy 'series'

 This page should only return the sermons belonging to taxonomy series
 'the-anointing', followed by podcasts belonging to taxonomy series 'the-
 anointing'.

 The Problem:
 Sermons is returning all taxonomy series, not just 'the-anointing' as is
 podcasts.

 'the-anointing' is the slug value.

 Below is how I registered 'series'

 {{{
 register_taxonomy('series', array('post','page','sermons','podcasts'),
 array(
         'labels' =>array(
             'name' => _x('series', 'taxonomy general name'),
             'singular_name' => _x( 'series', 'taxonomy singular name'),
             'search_items' => __( 'Search Series' ),
             'popular_items' => __( 'Popular Series' ),
             'all_items' => __( 'All Series' ),
             'parent_item' => __( 'Parent Series' ),
             'parent_item_colon' => __( 'Parent Series:' ),
             'edit_item' => __( 'Edit Series' ),
             'update_item' => __( 'View Series' ),
             'add_new_item' => __( 'Add New Series' ),
             'new_item_name' => __( 'New Series Name' ),
             ),
          'hierarchical' => true,
          'show_ui' => true,
          'query_var' => true,
          'rewrite' => array( 'slug' => 'series' ),
          )
          );
 }}}

 I'm guessing there is a bug somewhere along the line, but man I can't find
 it.

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


More information about the wp-trac mailing list