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
- How to exclude category ID from Looper in WordPress
- Add a specific part of current category page url to shortcode
- how do I get a specific post from a post with a subcategory in WP
- Clone Terms of one taxonomy to another
- WP grandchild categories in nested ul li
- Grab posts by multiple categories
- Pass Category Name, Description and Photo into variables to pass to jQuery
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- How to show single category archive
- Custom Template for one Taxonomy Term
- Move category description below post list in blog
- Unset actions for terms parent only
- How to pick the default selected value in wordpress dropdown?
- Get random out from get_terms()
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Get page that displays all children of taxonomy parent
- How to get original custom taxonomy slug after the slug has been rewritten?
- Create / Close Div in Array [closed]
- selected option if current category is the value
- Conditional based on number of specific custom taxonomy terms in archive.php
- get_template_part based upon post’s category
- Customize permalink wordpress category id
- how to save selected option in variable for rest api category filter
- Setting default category base on theme activation
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Categories order with get_terms_args not working in 4.7
- Hide subcategories (widget)
- Get term siblings of current child taxonomy
- Counter in loop in foreach
- Alert Bar section within WP loop is displaying even though there are no posts
- Let Users Choose Post Categories
- Sticky posts per category
- Different post styles depending on category
- How to get post’s current parent term ID?
- Display category name only once inside loop
- How to get custom posts sub category link
- Display Posts Loop for each parent and for each Child
- Faceted search with WP-API data
- Insert term and child term from frontend
- Make a custom_post translatable
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- Is There a Difference Between Taxonomies and Categories?
- Show List of Terms (not posts) that have been Recently Updated?
- Foreach inside shortcode not working as planned
- import_id parameter for wp_insert_term to create custom ID for category
- Programmatically add posts add and assign postmeta and assign terms
- How to show only subcategories in parent category not parent category?
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- When using the get_terms and trying to order the terms using the ‘order’ and/or ‘orderby’ does not work
- get_terms – name__like a number
- Woo Framework: woo_cat_featured not populating
- Get posts from specific taxonomy term
- Get posts under a category with SQL
- how to show only specific category for a template
- Redirect to another page using contact form 7? [closed]
- Query to get term id using post id?
- Getting category URL with hyphens, not spaces
- Display post category in foreach loop
- Category.php template for custom posts
- Why does wp_get_object_terms add a period after terms are output?
- Dilemma of Populating all the categories in a drop down list
- Conditional Statement with Multiple Terms?
- Display most popular posts of category
- How to apply comma separation,strip_tags and orderby to wp_get_object_terms
- How to get a post’s associated taxonomies and terms in wp api v2
- Create menu locations for each category in wordpress
- Creating sub-categories via php
- get_terms function not returning anything
- Display custom taxonomy attached to the post on post single page
- wp_set_post_terms is assigning only the last of several terms to a post
- Define specific category name in PHP
- Different Output for “Every Other” Foreach Statement?
- wp_set_object_terms not working inside loop
- Leveled – Terms foreach
- Edit the_category (); for a hierarchical display
- JSON REST API WordPress only showing first 10 categories
- Category title output before opening title tag