Opened 9 years ago
Closed 9 years ago
#36192 closed defect (bug) (duplicate)
Custom post types don't show on built in taxonomies
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4.2 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
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:
add_action('pre_get_posts', function (&$wp_query) {
if (is_category()) {
$wp_query->query_vars['post_type'] = 'any';
}
});
Change History (1)
Note: See
TracTickets for help on using
tickets.
Duplicate of #19471.
See also #16233