You need to hook into the query because the category archive page explicitly only includes the ‘post’ type and nothing else.
function namespace_add_custom_types( $query ) {
if( (is_category() || is_tag()) && $query->is_archive() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'post', 'myposttime'
));
}
}
add_action( 'pre_get_posts', 'namespace_add_custom_types' );
Modified from this article on CSS Tricks.
Related Posts:
- Filtering a custom post type by custom taxonomy in archive template
- Displaying category archive of custom post types
- Regex problem in an add_rewrite_rule
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Category page only displaying the posts from a custom type
- custom taxonomy archive by year
- CPT Archive with core Category
- Custom Post Type Archive Page Filtering
- Archieve.php not loading for custom post type
- multiple custom post type on category page
- Archive Template being used instead of Category Template for Custom Post Type
- Menu’s breaking, now showing all page links on site
- Advanced archive url structure (category, tag and date)
- Display all Categories except ones with a specific parent
- Custom WordPress theme not displaying posts from category
- Adding Custom Post Types to category/tag/author archives breaks header content
- Custom category taxonomy – archive page not showing up
- How can I generate a list of post-type specific categories?
- Custom Post type archives / categories give 404
- archive.php can’t find categorized posts
- How can I set up the URL for a category archive for a custom post type?
- Categories in custom post types
- Stop header code from showing in category page?
- Add Category Taxonomy Support to Custom Post Type
- Adding Categories to a WordPress Custom Post Type?
- Creating “static” taxonomies to choose from, inside custom post type?
- Pagination throws 404 error on custom taxonomy archive pages
- WP_Query ignores post_type in category view
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- Custom Post Type Archive URL takes over page URL
- How to Add Pages Under Custom Post Type URL Structure?
- How can you make permalink work for custom post type and taxonomy?
- Filter get_categories() for taxonomy term in WordPress
- Include Custom Posts Type in Year/Month/Date Archive
- where can I see my custom post type archive template?
- get_terms won’t display product_cat or any other custom taxonomies when specified
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- Show Post Count of a Category
- Custom Post Types and archives
- Combining custom post type and post category
- How to get “custom post type”-archive with working permalink to it?
- Filter categories of posts with checkboxes
- Use post as category
- How to change post featured image using a custom field of category?
- Custom template page with custom archives listing by user
- Display all posts in main category and 1 subcategory
- Root slug of taxonomy returning 404
- Show category ID on custom post type
- How to call in Custom Post-Type Categories?
- get_category_parents for custom post type taxonomy
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- Remove CPT name from permalink but add %category% instead
- Set a checkmark in a category based on a URL-parameter
- I am having Trouble to get list of Categories of Custom post Type
- Custom post type and category link together
- Categories filtering in new post
- Custom post type posts don’t show in archive widget
- Archive for a Taxonomy of a Custom Post type
- How can I have different content for different countries?
- Return the name of the post type
- Invalid Taxonomy
- archive as a page, so that it can be added in the wp_menu_nav
- custom query with custom post type and category slug
- Custom Post Type Archive Pagination
- Use post in multiple places on a page with multiple posts
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Custom post type specific category box
- Custom Taxonomy Taxonomies of Same Name point to first created URL
- How can I allow users to edit text that will be displayed on a custom post type archive page?
- How can I increase the post count for custom post types only?
- category.php not showing custom post types
- Post category behave like a Post in back office menu
- Save data is post using php front end
- Custom Post Type Archive Page showing as 404
- Modify category permalink to use post type slug
- How to output custom post type title on custom page with category next to it?
- Create custom post type categories
- Set a Default CPT taxonomy by taxonomy id
- Automatic Set Category For A Custom Post Type
- how to create custom taxonomy drop downs for parents and child
- Only show categories that have posts within custom post type
- can’t see categories in appearance-menu-categories
- Custom nav menu current item custom link problem
- Custom Post Type + Category archive
- Stop Custom post type from being searched via URL
- Exclude categories For Custom post types
- archive-{custom_post_type}.php not getting recognized wordpress
- Show custom post type in archive page by category
- I have a custom post type that I want to query a dynamic category name from a custom meta field
- Display all post types together
- Trying to create hierarchy between 3-4 custom post types
- Displaying wp post categories into my custom metabox
- Display results from two Custom Post Types in page template
- WordPress custom post type post and category links 404
- Pagination not working for archive
- One set of categories for multiple custom posts
- Choose custom post type template by category
- Are custom posts included when getting a categories’ posts?
- Show custom category archive as front page and remove taxonomy slug from urls
- Categorizing Custom Posts in Bulk Based on Title