Custom post types are excluded from the main query by default (except on taxonomy pages and custom post type archive pages), that is why you don’t see posts from your custom post type on your category page.
You need to include your custom post type posts in the main query manually. That is done with pre_get_posts
which alters the main query before it is executed.
You can do the following to include your custom post type on category pages
function custom_post_type_cat_filter($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_category()) {
$query->set( 'post_type', array( 'post', 'YOUR CPT' ) );
}
}
}
add_action('pre_get_posts','custom_post_type_cat_filter');
Related Posts:
- How do you get the count of posts in an archive page?
- How to show Y number of custom posts after every X normal posts?
- Custom Post Type Pagination Not Working On Archive Page
- Archive page…limiting posts per page
- Adding custom post type to loop
- Pagination go to first page if i’m on last post
- Grossly inefficient wordpress loops!
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Taxonomy posts on Archive page
- How to show related posts by category or custom post type?
- exclude custom post type by meta key in wp_query
- Get the title of custom post type in another loop
- Posts navigation in custom post type single.php not working
- Unable to get post content from custom post type loop
- Display custom field of specific post where post title matches variable
- How to check if “is single” page
- Using pre_get_posts to filter one loop in a multiloop archive
- Custom Post Type Loop within Shortcode
- Pass the_post() as a parameter
- get_template_part and template file names
- Display CPT posts based on specific taxonomy
- Creating select dropdown with parent-level custom post types
- Show one item per category of a custom post type
- Loop custom taxonomy to get lists of cutom post types?
- Multiple Loops On Custom Post Type Template?
- Show a Category X’s custom post type on Category X archive page?
- Sort by alphabetical order archive.php page
- Custom Tag Description unable to display just below and outside of the Loop
- Displaying Custom Posts on a Page
- Custom Post Type within the Loop on Homepage (Page Template)
- Custom Theme With Custom Loops
- Listing all term items alphabetically / sorting loop
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Three Most Recent Posts, One Per Term
- Does WP have a global of $id?
- Bootstrap accordion looping through posts incorrectly
- the_post() is printing titles in page footer
- Two column layout with alphabetical ordering
- Dynamically insert code to custom post type loop
- hide specific div on single.php [closed]
- Looping Through Categories of a CPT
- Search Filter CPT, Custom Loop
- How do you output an unknown number of images in a custom post type with desired markup?
- Pull in taxonomy field of custom post type in new query
- How to add a lightbox to class mix?
- Get post content from another section in custom single page
- Posts are not rendering perfectly [closed]
- Query all post types but limit to parents
- Looping through custom taxonomy and display custom post types (Custom Post Type UI)
- Displaying information from custom field on custom post type
- Display only a single CPT
- Custom post class, generate unique id from 1 to x depending on amount of posts?
- Create a custom taxonomy template that loops through child categories in term order?
- Control Loop Within Loop
- Why is the output of a call to the_excerpt different when the call seems to be identical?
- Get post-meta value of all custom-posts – lowest to highest year-count?
- How do I enforce a specific custom post type on the loop
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Only looping through pages that have children or subpages
- Custom Post Type Query W/Category Dropdown
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- creating a foreign key like relationship with custom post types
- Show the categories the current post has
- On click some element i want to use some template
- How to Enable Ascending or Descending In WordPress Default Built-in Loop
- Fetch data from two custom post types and create multidimensional array for output to html table
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- How to display posts from a certain category in a bootstrap 5 carousel loop with multiple items?
- Loop all post on single.php
- Pin posts to top of custom loop
- Pagination not working in custom post type. Help
- Accessing download link from the loop with WP Download Manager Pro
- Custom WordPress theme not displaying posts from category
- Combine multiple separate lists into one
- WordPress trying to query two custom types to get child from the parent
- Display title of all custom posts from same taxonomy term on a custom post template
- custom post type single page
- How to prevent post to repeat on my loop?
- WordPress query in which condition uses custom field
- Custom post types not displaying per category
- How to show Y number of custom posts after every X normal posts?
- Pagination in custom post type page template
- Load different template for CPT (in loop) in my plugin?
- How to loop custom post type posts by author?
- WordPress nested loop not working
- Order by custom field attribute
- Inserting random posts
- next_posts_link returns same content of 1st page
- Custom Loop and Standard Blog Loop Issue
- Custom loop won’t work, can’t find problem
- Categories and page filtering with pre_get_posts
- Loop through multiple custom taxonomy terms and display posts for a custom post type
- loop through custom post-type with two meta_keys
- Loop to pull content from parent element in custom post type [duplicate]
- How to exclude certain portfolios from a loop
- How to create custom page templates with default page layout framework?
- How to insert a post from a different post type after every nth post
- Complex Custom Loop with Includes
- How can I incldue a “private” post type in a loop for public users?