Devlog

Show custom post types in category archives

Custom post types are not displayed in the category and tag archives by default, even if you indicated in the register_post_type call that it should support these taxonomies.

The way to include them in the category and tag archives is to use the pre_get_posts action:

add_action('pre_get_posts', 'mycode_pre_get_posts');

function mycode_pre_get_posts($query) {
  if ((is_home() || is_category() || is_tag())
    && $query->is_main_query())
  {
    $query->set('post_type', ['post', 'mycustom_type']);
  }
  return $query;
}