[wp-trac] [WordPress Trac] #36192: Custom post types don't show on built in taxonomies

WordPress Trac noreply at wordpress.org
Thu Mar 10 10:10:18 UTC 2016


#36192: Custom post types don't show on built in taxonomies
--------------------------+-----------------------------
 Reporter:  pcfreak30     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.4.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If you add a CPT, then add support for the built in category or tags, the
 categories page(s) for those taxonomies will not show the CPT items, only
 post/page.

 The following action has to be used to fix it:

 {{{#!php
 add_action('pre_get_posts', function (&$wp_query) {
     if (is_category()) {
         $wp_query->query_vars['post_type'] = 'any';
     }
 });
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36192>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list