The default query doesn’t include custom post types. You have to use pre_get_posts hook to modify your query. Hope this solves your issue
function custom_posttype_query( $query ) {
if( (is_category() || is_tag()) && $query->is_archive() && empty(
$query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'post', 'gallery'
));
}
return $query;
}
add_filter( 'pre_get_posts', 'custom_posttype_query' );
Related Posts:
- How to change permalink structure for custom post type and it’s taxonomies?
- Get the first post term
- Creating “static” taxonomies to choose from, inside custom post type?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to list all categories and tags in a page?
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- How can you make permalink work for custom post type and taxonomy?
- How to get a list of term names of the custom post type im currently on in single.php
- List all custom post type posts from a given category?
- Custom post type taxonomy template
- 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
- Show Post Count of a Category
- Custom Post Types and Categories?
- How to create new category for custom post type?
- Get Post Primary Category
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- How to get the post type from a category id?
- How to show CPTs in term archive
- Display all posts in main category and 1 subcategory
- Show category ID on custom post type
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Limit amount of posts made within a custom taxonomy
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Categories and tags for custom post types
- get_category_link() for custom post type does not include custom slug rewrite?
- Targeting categories in custom fields
- Invalid Taxonomy
- Need help deciding on a taxonomy
- Get Posts by Category, Tag , and CPT Taxonomy
- Get assigned post categories
- Categories won’t appear on custom post type
- Custom Post Type with modified permalink structure results in 404
- Custom post type, taxonomy and admin bar
- Displaying taxonomies as category links within sidebar and creating pages for these
- Custom post type archive page filters
- How to show related posts of category on post within custom posttype
- get taxonomies from terms
- Create custom post type categories
- Set a Default CPT taxonomy by taxonomy id
- how to create custom taxonomy drop downs for parents and child
- How to manage a dynamic multi-level page hierearchy system?
- Categories manage
- I can not call the categories of custom post type
- Reuse the “category” slug for a custom post type
- How to create groups like that in buddypress?
- Update Cateogory Taxonomy Count for Attachment Post Type
- Best way to structure article and issue relationship for CPT
- Custom Post Type used for FAQs Accordion
- category_name not working in WP_Query
- How can I set up the URL for a category archive for a custom post type?
- Custom Post Type order Title ASC
- show only one category posts in admin
- Is it possible for post and custom post type to share a category base slug?
- Add taxonomy or category slug to custom post types URL
- How to determ a custom post type url?
- Adding categories to custom post type in permalink
- How do I append multiple taxonomies to the URL?
- Only list categories that contain posts of a specific custom post type
- Remove quick edit for custom post type
- Count posts that have specific taxonomy term attached
- Taxonomy archives based on Custom Post Type
- Get the ‘slug’ of a custom taxonomy
- Include custom post type in “all posts”
- Get all taxonomies for all post types
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Custom Post Types and independent Categories – complex Taxonomy
- Custom Post Type Archive Page Filtering
- How to conditionally redirect to the post from a taxonomy page?
- Category with post type pagination returns 404
- How do I share categories across multiple post types?
- How to Set Taxonomy Object Description?
- category page for custom post type
- Getting used tags per post type
- Navigate posts with different post type that are in the same categories
- Variable not working in WP_Query
- Associate all Custom Post Types with Taxonomy
- Alphabetically sort a taxonomy.php template by post title
- Show Taxonomies with admin area for custom post type?
- How to get the current category with custom posts
- List child categories from parent category on custom taxonomy page
- CPT archive with WP native/core tax/categories
- How to display custom taxonomy term specific post?
- How to sort post category using its Description
- Custom WordPress theme not displaying posts from category
- How to transfer categories (default) to custom taxonomy?
- Modify the category post counting function
- How to create TEMPLATES for TAXONOMIES? What I have to change in this code?
- Custom Post type archives / categories give 404
- Sorting on Taxonomy in archive page
- Problem to show custom post type in archive page category wise
- Taxonomy Grid Archive Help?
- Author template – separate custom post type by custom taxonomy term for $curauth
- Get all custom_post_type posts + blog posts from one category in a single query
- See the process of creating a taxonomy and tell me where I made a mistake
- How to add to taxonomies to a post type
- Custom post type category pages pagination returns 404