The category parameters does not work with custom taxonomies. You need to use a tax_query
instead.
In your current code, replace (which is in any case also wrongly used, category_name
takes the slug, not name)
'category_name' => $category->name
with
'post_type' => 'case-studies',
'tax_query' => array(
array(
'taxonomy' => $tax
'terms' => $category->term_id,
'include_children' => false
)
),
Related Posts:
- Get all taxonomies for all post types
- Is it possible to use array_walk() to append terms to an array of posts?
- get_terms by custom post type
- Get Posts by Custom Post Type ,Taxonomy, and Term
- How to limit the number of terms (terms acts like categories)
- How do I list custom taxonomy terms without the links?
- wp_insert_term doesn’t work with custom post type’s taxonomy
- show tags of custom post type ONLY
- Count posts that have specific taxonomy term attached
- Retrieve single term slug
- display multiple term post from taxonomy in a single page
- How to get a list of term names of the custom post type im currently on in single.php
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- How to get only one category of custom post type?
- Get list of terms of current taxonomy archive for another taxonomy
- List all custom post type posts from a given category?
- Category page only displaying the posts from a custom type
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- How to filter out post type meta?
- How to output wordpress custom tags separated by comma?
- Have a Custom Post Type index page display taxonomy items instead of posts
- Get Post Primary Category
- How to check the terms in single custom post type template
- Custom query to filter posts that have current post as a taxonomy [closed]
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Custom post taxonomies as tax_query terms?
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- How do I display the taxonomy for a custom post type in an array
- Foreach inside shortcode not working as planned
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Different Category system needed for the Custom Post Type
- Output terms for custom post types
- I need to add a filter to prepend the term ‘National – ‘ to the post title if the post is tagged to multiple states
- Pagination hitting 404 page on /page/4
- custom hierarchical taxonomy and custom post type list contains surplus posts
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- Query custom post types & Taxonomies and list them in a table on a page
- meta query not retrieving posts
- Commas not displaying in implode
- Custom Taxonomy Terms in Menu lead to which page?
- Get posts by category name
- Custom Post Type Taxonomy Term Order by Title
- Using page title as a link to term archive
- How to get post count of specific taxonomy that have store name & category
- How to automatically create a terms based on each post of a post type
- Get List of Terms based on a given term (different taxonomy)
- Page that lists publications by classifying them by taxonomy
- CPT : Next or Previous term link when has not adjacent post
- Order posts by taxonomy terms
- Filter taxonomy by CPT
- automatically select taxonomy based on post meta
- I’m having trouble with Related Product “tax_query” ‘terms’ value
- get taxonomies from terms
- Display Custom Post Type Based on Taxonomy With WP_Query()
- How to order taxonomy terms by most recent post?
- Taxonomies are not showing in the category dropdown
- Taxonomy doesn’t follow slug permalink structure
- Get all posts for custom taxonomy term
- Custom Taxonomy – fields
- Pages of my taxonomy terms are showing all posts
- tax_query not working?
- Add active class to foundation 6 tabs while looping categories
- Filter Term By Parent Term – Custom Post Type
- Filter By Term Not Working – Custom Post Type
- Displaying the Taxonomy and a Queried Term on a taxonomy.php page?
- WordPress get all post with like in terms [duplicate]
- WordPress add taxonomies/terms list as a menu in archive page
- Decrement term in for each
- Fetch posts list from fist CPT taxonomy term and list under 2. CPT
- Create an additional template page for every term taxonomy
- Custom Search not working
- Exclude Custom Post Type from shared Custom Taxonomy
- Taxonomy Grid Archive Help?
- Custom post type URL returns 404 error page
- List a custom post type’s posts ordered by nested custom taxonomy
- Looping taxonomy in taxonomy?
- Author template – separate custom post type by custom taxonomy term for $curauth
- get_the_term_list() wanting to loop through the returned values
- List custom taxonomy terms
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List
- Add Category names to post lists of custom post type
- How to I add count of custom posts listed in a post as a prefix to its title
- WordPress taxonomy and terms question
- Taxonomy Archive URL + Template
- Renaming Custom Post Types and Taxonomies
- Inconsistent temporary 404s on whole install | PHP error with post-template.php
- How can I add dropdown widget/box to admin post page?
- How to create new category for custom post type?
- Received nothing after executing AJAX post function
- Categorize custom post type
- how to echo meta tag in header using php
- PHP question: how to combine syntax?
- Importing JSON feed giving Notice: Array to string conversion error
- Grab all Custom Posts by multiple taxonomies and terms
- How to display custom taxonomy term specific post?
- How to make sure, that only the selected post is changing?
- How to create TEMPLATES for TAXONOMIES? What I have to change in this code?
- Custom Post Status & Taxonomies
- How to add a post counter to the list of custom taxonomy terms?