itsmattadams
says
I noticed that tags and categories weren’t showing up when using 'taxonomies' => array( 'category', 'post_tag' ) on a custom post type. So, I Googled the issue and came across this useful function. The following code is modified to only show the custom post types in the tags and category archive page.
function include_custom_post_types( $query ) { global $wp_query;
if ( !is_404() && !is_admin() && !is_author() && !is_home() && !is_preview() && !is_singular() ) {
$post_types = get_post_types();
$custom_post_type = get_query_var( 'post_type' );
if ( empty( $custom_post_type ) ) $query->set( 'post_type' , $post_types );
}
return $query;
}
add_filter( 'pre_get_posts' , 'include_custom_post_types' );

