try this, it’s work for me.
$args=array(
'posts_per_page' => 50,
'post_type' => 'my_custom_type'
'cat' => $cat_id,
);
$wp_query = new WP_Query( $args );
Category Parameters
cat (int): use category id.
category_name (string): use category slug (NOT name).
category__and (array): use category id.
category__in (array): use category id.
category__not_in (array): use category id.
Related Posts:
- Exclude a category from WP_Query
- WP_Query ignores post_type in category view
- category__in not working on custom post type
- List with categories, subcategories and posts of custom posttype
- New WP_query in template not working with CPT+category on some pages
- WP Query group/order by category name
- List all custom post type posts from a given category?
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts
- Query Custom Post by Category
- Loop through categories and create tab for each
- Getting all custom posts with a certain category
- Query Custom Post Types & category_name?
- Show Post Count of a Category
- CPT posts listed by category with custom rewrite URL, please help!
- Querying Term Posts in Loop
- Pagination on category page with custom post types
- How to show CPTs in term archive
- showing custom post types of a certain category only
- Linking to the most recent post in a Custom Post Type
- Show custom post type filtered by category
- forming WP_Query for posts of all post types but from specific categories
- WP Query with categories only shows one post and ignores the category
- Why is my category template ignoring post type?
- WP the_posts() on single-cars.php get category link
- WP_Query Custom Post Type if Category ID Equals
- Custom post types and ‘new WP_Query’
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- List categories, subcategories and posts from custom taxonomy and custom post type
- WP Query results showing posts outside of category ID
- How to get Custom Post Type with Categories wise in WordPress using wp_query
- Create query for both custom post type and category
- How to properly use Categories with Custom Post Types
- How to output custom post type title on custom page with category next to it?
- Custom Post By Category
- Only show categories that have posts within custom post type
- Query the title of the page to show posts with matching category in the loop
- Only show current category post
- Can’t seem to filter wp_query by current category ID
- Custom Post Type + Category archive
- category_name not working in WP_Query
- Get all custom_post_type posts + blog posts from one category in a single query
- Using tax_query to get single post per category
- Are custom posts included when getting a categories’ posts?
- Is it possible to make is_category() recursive?
- Add custom post type items from frontend
- Custom Posts Types using Posts Category
- How do I get a meta value from WP_Query?
- How to get a list of term names of the custom post type im currently on in single.php
- Categories or Custom Post Type to Organize Content
- Custom post type taxonomy template
- Re-order posts in query after
- How do I Use Nested Loops of Custom Post Types for MultiSite Blogs using WP_Query()
- Page naming when there is a sub-category only sometimes.
- Get the next event using date_query
- Impossible to get Attachments Outside WordPress?
- Category page only displaying the posts from a custom type
- Help Structuring Query for Archive Pages
- Is it possible to create a shortcode that will query a post based on taxonomies?
- wpdb custom post_type problem
- Query custom post type in the loop
- Filter CPT posts by one or more categories
- Troubles with acf/save_post and WP_Query
- Query custom post type with ACF Date
- WordPress request fiter order by related post’s post_title
- Order Custom Post Type by Custom Field Value
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Categories and tags for custom post types
- WordPress wp_query() basic question about args
- Meta data (Tags and Categories) for Custom Posts not showing.
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- How to properly rewrite pagination rules for a CPT to avoid 404 error on /page/2
- $post->post_meta not pulling any post in wordpress/php
- How to get the post terms from a child taxonomy
- display posts of custom post type with custom taxonomy
- Custom Post Type posts not showing in category
- WP_Query get post from a category and from another post type
- foreach loop inside the loop creating duplicates in output
- Sorting by meta_key different to search criteria?
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Custom Post Type ‘Event’: Chronological list of recurring events from meta_values in array
- How to divide Subcategories into pages of parent category wordpress
- Pagination in custom post type archive.php not working
- WP Query: If field X is empty, show posts based on field Y
- meta query condition don’t work
- create a “add icon” field in taxonomies page
- Custom post type category returns null
- Tell wordpress to show a single page instead of an archive page
- How to get post by meta value
- minimize wp_query call to database
- sorting in wp query based on custom field value
- Use Category for Custom Post Type – But Need Another Separate Archive Page too
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- Page to show custom posts and one category
- Query Posts From Multiple Post Types
- Bulk remove category from custom post type?
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- querying to custom field over ACF REST API
- Can I add a wordpress page using the slug for a CPT rewrite