category_ID
is not a valid key for WP_Query
. cat
would be available instead, if you want to query a category:
Example:
$args = array(
'numberposts' => -1,
'post_type' => 'rooms',
'cat' => 8,
);
$the_query = new WP_Query( $args );
If your category is not actually the taxonnomy category
but a custom taxonomy, this would be another way to query it:
$args = array(
'numberposts' => -1,
'post_type' => 'rooms',
'tax_query' => array(
array(
'taxonomy' => 'your-category-taxonomy',
'terms' => 8,
),
),
);
$the_query = new WP_Query( $args );
Hope this helps.
Related Posts:
- WP_Query by a category id and a custom post_type
- 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
- 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?
- How to display regular posts & custom post types that fall under a category using just the generic category template?
- How to filter custom post types by custom category taxonomy
- Pagination not working with custom category template
- Remove date and category filters when editing custom post types
- WP_Query to loop a Custom Field, Custom Post Types do not show
- Using Query Posts With Multiple Post Types And A Taxonomy
- Anyway to assign custom post types to a specific category?
- Custom Taxonomy List links being re-written
- wp_list_categories and custom post types
- Can’t sort order of wp_query with 2 meta keys
- Get count of custom post type created by current user
- How can i list custom post type categories?
- WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?
- Custom post query by taxonomy
- Add category in post type dynamically
- Group custom posts by custom taxonomy names
- Use regular category with custom post types
- Can’t query tag and post_type at the same time
- Wrong request query on cpt and tax
- Separate custom categories from default category
- Converting the_content string to an array?
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Custom post type, organized by categories
- CPT category hierarchy
- Creating two loops based on different logic
- get_category_link() for custom post type does not include custom slug rewrite?
- Custom post type loop with custom category filtering
- Assigning a category to a custom post type in WordPress
- Show message when query has no posts
- Get category if used in a custom post type
- How to show all taxonomies within custom post type loop
- Trying to add a class to post links
- WordPress custom post categories and subcategories on category.php
- Two queries – one with checkbox ticked, one without – comparing meta_query
- posts_per_page in custom WP_Query does not override “Reading” settings?
- Display Parent-Child Posts in specific order by comparing IDs in array
- Apply category query clause to posts of custom type
- SEARCH QUERIES – REVERSE OUTPUT
- WP_Query to display number of custom post type filtered (order by) taxonomy
- 2 modal windows with ACF content on Archive page
- post_type incorrect for custom post type
- Live search by custom tag
- Set a Default CPT taxonomy by taxonomy id
- Custom Post Type – Display all, wrap in groups of 3
- how to create custom taxonomy drop downs for parents and child
- How to get the posts that my following users are liked?
- How to create groups like that in buddypress?
- Display all Custom taxonomy terms and their relevant custom posts
- Getting list of Categories for Custom Post Types
- CPT or Custom Table for Repository of Serial Numbers
- Query Pulling the same post twice
- I have a custom post type that I want to query a dynamic category name from a custom meta field
- Custom post-type’s pagination not working in category.php
- Listing all custom post types using a specific term on the said term’s template page, in groups
- WP Query – Can’t get posts with specific taxonomy