[wp-trac] [WordPress Trac] #12730: Custom post types not appearing on core taxonomy pages

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 12 16:27:53 UTC 2010


#12730: Custom post types not appearing on core taxonomy pages
--------------------------+-------------------------------------------------
 Reporter:  aizatto       |       Owner:  filosofo                  
     Type:  defect (bug)  |      Status:  new                       
 Priority:  normal        |   Milestone:  Unassigned                
Component:  Taxonomy      |     Version:  3.0                       
 Severity:  normal        |    Keywords:  custom post type, taxonomy
--------------------------+-------------------------------------------------

Comment(by matthewhollett):

 I was running into the same problem, and realized it was basically the
 same problem I noted in #12943. The workaround that rovo89 posted there
 works here, too. Here is the code I am using in functions.php to fix both
 tag pages and feeds - replace "customposttypeone" and "customposttypetwo"
 with the names of your custom post types.

 {{{
 // Include custom post types in feed and tag requests.
 function customrequest($qv) {
         if (isset($qv['feed'])) {
                 $qv['post_type'] = array('post', 'customposttypeone',
 'customposttypetwo');
  }
  if (isset($qv['tag'])) {
                 $qv['post_type'] = array('post', 'customposttypeone',
 'customposttypetwo');
  }
         return $qv;
 }
 add_filter('request', 'customrequest');
 }}}


 I suspect that this is a problem that many people will run into once they
 start using custom post types, and the solution is not obvious, so it
 would be great if custom post types could be more closely integrated into
 core.

 Hope this is helpful!

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


More information about the wp-trac mailing list