You can directly add 'taxonomy_name'=>'term_slug'
in your current code.
$posts = get_posts(array( 'post_type' => 'product', 'file_type'=> $category->slug, 'custom-category' => 'learning-units' ));
For more reference check WP_Query Taxonomy Parameters
Related Posts:
- wp_list_categories: order by term order?
- List all categories but exclude current post category on single post page
- Problems with function on function.php
- Difference between get_category, get_term_by and get_categories
- get_terms from registered taxonomies not working
- Invalid argument supplied for foreach() in search.php
- Display custom taxonomy on single post
- Group child category IDs based on their parent category
- Getting all categories even with no products under it?
- Include Parent Term in wp_list_categories
- Get all categories post is not in
- Add HTML to Term Description
- Display posts belonging to child term
- How to create a array that contains all of the children slugs of a specific parent category
- WordPress custom taxonomy
- How do I edit the terms output args or array data?
- Create category after theme setup and modify the default one
- I can get posts in all categories. But I want to get the custom post type I created
- how to show all categories by get_terms
- Is there any WordPress way to get all categories for some selected posts?
- WordPress using get_term to retreive slug not working as expected
- Get terms parent ID for conditional IF statement
- Incomplete term slugs output from a foreach loop with get_the_terms
- Control term order on a per-post basis
- Why does WordPress combine a term with the same name in the wp_terms table?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Load custom posts with same tag as page
- same taxonomy for several post types: how to hide empty in a specific post type?
- How to sort terms with diacritical signs?
- get_terms(); show private posts when logged in
- Send an email when custom post type category is changed
- How to find objects by terms
- get_post_terms not working as expected
- Display Categories Assigned to a WooCommerce Product
- Removed slug from CPT, now How/where do I hook the filter to the taxonomy term archive pages link?
- Action hooks returning old category instead of new category
- Wp set post terms not work
- Display empty taxonomy terms with get_terms()
- Get the Term List – Ordering
- Reduce / optimize calling of wp_get_object_terms() when generating permalinks
- Use template for posts with a particular category grandparent
- How to order and count get_terms by specific post type?
- How to change / delete product short description in Woocommerce
- Get direct children of custom taxonomy
- How to output wordpress custom tags separated by comma?
- Custom category code not showing all posts
- I want to loop through Woocommerce Product Catogories and show them in dropdown
- setting taxonomy term to bulk posts using ids
- display taxonomy slug from term ID
- Query all posts of a custom taxonomy term
- Get posts inside Get terms problem
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Get random out from get_terms()
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Let Users Choose Post Categories
- Foreach inside shortcode not working as planned
- Get posts from specific taxonomy term
- Display most popular posts of category
- List taxonomy term slugs within shortcode (do_shortcode)
- get taxonomy thumbnail and use it as a variable in code
- Copy taxonomy terms from one post to another programmatically
- Get all terms linked to a post and include those who not connected from get_terms and sort
- Getting taxonomy images to display on single-post with their terms
- Get terms within a custom taxonomy
- Isotope Drop Down Categories Filter Function
- Only show size attributes in product box woocommerce when available
- Argument for if term-> have child?
- Is it possible to use array_walk() to append terms to an array of posts?
- Echoing a CSS class based on category of post in a list
- Custom term templates
- INSERTING Data into table with placeholders
- is user member of a group, show them categories [closed]
- Using multiple variables to assign categories to an array
- Taxonomy Drop Down with hierarchical view using $terms
- displaying the categories post
- Add properties to term object
- Pagination at category doesnt work with same name of page
- Sort categories by custom field in WordPress admin
- How to retrieve taxonomy Metabox fields in frontend
- Child-Theme Category View with modified permalinks (%category% removed)
- How to display custom taxonomy term specific post?
- Why does term get inserted twice when using dynamic slug?
- How to move a post from one category to another
- Displaying 3 Category Posts differently
- Add subcategories posts to the counts column at the admin’s categories list
- How to list categories by page id in wordpress
- Unable to retrieve any child terms using get_terms
- Showing the project type in HREF
- Front end post submissions do not get submitted in the category
- List Terms by category
- Category foreach Paging
- Trying to exclude posts from a category on the home page
- Showing Subcategory’s Name and Link Instead of Parent Category’s
- Show a Category Specific Info Box
- How to get all the terms of a post
- Remove /category/ from category (archive) page URLs (without using a plugin)
- Using ACF custom field for custom post type to order categories
- Relate term to term?
- get_the_term_list give me a whitespace
- How can I filter get_terms with post meta