Opened 15 years ago
Closed 14 years ago
#12730 closed defect (bug) (worksforme)
Custom post types not appearing on core taxonomy pages
Reported by: | aizatto | Owned by: | filosofo |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Taxonomy | Keywords: | custom post type, taxonomy |
Focuses: | Cc: |
Description
I'm running into a few problems with using custom post types using a core taxonomy (post_tag). Where visiting the tag page will not display the custom post type.
I have created a custom post type with:
register_post_type('ticket', array( 'label' => __('Ticket'), 'public' => true, 'show_ui' => true, 'supports' => array('thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'title', 'editor') ) );
then I registered the post_tag taxonomy to it
register_taxonomy_for_object_type('post_tag', 'ticket');
I created a Ticket, and tagged it (lets say with the tag "lion"). I tried visiting the page for the tag ie http://example.com/?tag=lion but it does not show up.
Change History (3)
Note: See
TracTickets for help on using
tickets.
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.
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!