[wp-trac] [WordPress Trac] #20040: Setting query in pre_get_posts and custom post types unassigned to any category

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 14 11:05:46 UTC 2012


#20040: Setting query in pre_get_posts and custom post types unassigned to any
category
--------------------------+-----------------------------
 Reporter:  novakpeter    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Types    |    Version:
 Severity:  major         |   Keywords:
--------------------------+-----------------------------
 In functions.php:

 {{{
 function my_query_post_type($query) {
     global $wp_query;
     if ( is_category() && false == $query->query_vars['suppress_filters']
 ){
         $query->set( 'post_type', array( 'post', 'my_post_type' ) );
     }
     return $query;
 }
 add_filter('pre_get_posts', 'my_query_post_type');
 }}}

 If posts within "my_post_type" custom post type are assigned to a category
 within custom taxonomy, this code works. If they are not assigned to any
 category, this code doesn't work for them - but probably should.

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


More information about the wp-trac mailing list