Why are posts from custom post type not displayed in “category” archive?


I’ve created multiple custom post types which should share “category”.

Creation is done like this:

 $args = array(
        'label'               => __('MyPostType', 'key'),
        'description'         => __('MyPostType', 'key'),
        'labels'              => $labels,
        'supports'            => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields'),
        'taxonomies'          => array('category'),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'menu_position'       => 5,
        'menu_icon'           => 'dashicons-admin-tools',
        'show_in_admin_bar'   => true,
        'show_in_nav_menus'   => true,
        'can_export'          => true,
        'has_archive'         => 'techblog',
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'post',
        'rewrite'             => $rewrite

register_post_type('myposttype', $args);

This works like expected and I’m able to use categories globally.

The Problem

The categories archive only shows posts from “post”. If there is no post it only says “nothing found”.
Within the single posts meta information the posts categories are listed. I can click them, and get a “nothing found” page.

Unfortunately the documentation says nothing about this. Do I need to do something else? I thought this should work out of the box.

Adrian 4 months 0 Answers 19 views 0

Leave an answer