If you associate your own custom post types with the built-in ‘category’ and ‘tags’ taxonomies in WordPress, to make them work in Tag, Category Archive pages, you need to add following code in the functions.php
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if(is_category() || is_tag()) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type = $post_type;
else
//in following line replace 'cpt' with your own cpt.
// note 'nav_menu_item' is added in below code for custom menus to work on archive pages with it.
$post_type = array('nav_menu_item','post','cpt');
$query->set('post_type',$post_type);
return $query;
}
}