Get this recipe’s assigned terms (recipe having $recipe_id
):
$terms_arr = [];
$terms_objs = get_the_terms($recipe_id, 'main_ingredient');
if ($terms_objs) {
foreach ($terms_objs as $term_obj) {
$terms_arr[] = $term_obj->slug;
}
}
Find the terms found in both arrays:
$the_ingrediens = array_intersect($ingredients, $terms_arr);
Related Posts:
- How to prevent new terms being added to a custom taxonomy?
- How to add images to taxonomies?
- Read-only taxonomy (user can assign term but can’t create or edit existing terms)
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Get second level terms of custom taxonomy
- Taxonomy menu with post count and multiple parents
- Sort Custom Post Type Archive by Taxonomy Term [duplicate]
- How to get the singular name of a custom taxonomy?
- Is it possible to have a taxonomy archive that lists taxonomy terms?
- Archive template for taxonomy terms
- pre_get_posts OR relation between taxonomy and author
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Dynamic page slug for Custom Taxonomies?
- show term description instead of list terms of custom taxonomy
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- get_the_term_list without specific category
- Add Category Name to REST API
- Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order
- Edit post meta with checkboxes on front end
- Set download limit and expiry for WooCommerce downloadable products in specific categories
- drop-down list taxonomy problem
- How to display custom taxonomy in multiple columns?
- Custom taxonomy sort by term meta in admin columns
- Storing data into custom taxonomies VS post custom fields (post meta)
- How to order a list of taxonomy terms alphabetically?
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- WordPress Custom Taxonomy – Volume / Issue – Unique Slug Issue
- get_the_terms issue
- How to show the entries in a custom taxonomy by author?
- ACF vs Taxonomies
- Reverse traversing taxonomy based on term_id
- Custom fields to taxonomy
- ‘wp’ action hook not firing in admin and login?
- Correct way to insert taxonomies on page insert
- Styling Taxonomy Terms Individually
- Get terms cross-taxonomy query
- Custom Taxonomy Template Error: Catchable fatal error: Object of class WP_Error could not be converted to string
- Custom Taxonomy in default RSS feed
- Taxonomies on custom taxonomies
- Get list of taxonomies associated with Subscribers
- How to add Post Format Taxonomy Archive page in the menu?
- How to add custom label or texts in featured image
- How to make custom post taxonomy looks like regular categories?
- Create Geographical regions -> countries structure and relationship with taxonomies
- Unexpected results from get_taxonomies() and {$taxonomy}_edit_form and related hook
- Custom taxonomy link opens under Posts
- Changing URLs for taxonomies and CPT
- Create custom taxonomy and Display in metabox dropdown
- how to store values in database at hierarchical view
- Strip tags from a the terms() function
- Why can’t I use an array of term slugs in WP_Query?
- Using wp_dropdown_categories in widget options
- Trying to add taxonomy to get_categories() but it’s not working. How to fix this?
- Proper WP conditional tag to check for existing taxonomies to list out terms with wp_list_categories?
- Custom taxonomy archive page requires ?post_type= in url
- Twin value tags as an esoteric taxonomy
- Clean Custom URL for Serach + Custom Taxonomy
- Advanced search redirecting to another page then filter further
- Filter through custom taxonomy with an array of taxonomy IDs
- Dropdown taxonomy lists in admin menu
- How to show post for a particular term of custom taxonomy?
- Is there a way to change select-list for new custom taxonomy?
- How to define %category% for custom taxonomies?
- How to list terms by first letter, as in A’s then B’s etc
- Taxonomy hide not working
- How do I get the correct URL?
- Create new Taxonomy, add extra fields, register terms AND extra fields values?
- Query all images with certain tag in media library using visual portfolio plugin
- See double taxonomy inputs in WP editor
- How to change custom categories term links?
- Body class to each level of a hierarchical custom taxonomy
- Problem with wp_list_category with custom taxomy
- Restructuring permalink with more than one taxonomies
- Restrict viewing of posts by category, user role
- How to limit custom post category
- Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta
- ajax drop down change second drop down data
- Redirect or Prevent Viewing of Custom Taxonomy’s Archives?
- Display taxonomy term slugs
- Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?
- Get Posts by tag from a custom taxonomy
- Run next query based on first query’s term
- Get the original menu item name string instead of the label
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Tax query array terms display out of order
- How to change taxonomy slug?
- Taxonomy to WordPress Permalinks of custom post type
- Advanced AND tax_query in sidebar with 2 taxonomies
- Function code problem
- Permalinks not working on MU network with domain mapping
- Create WordPress taxonomies based on theme settings
- Alternative for is_taxonomy() to workaround theme’s default sidebar
- Get custom taxonomy term url on archive page
- I’ve got a function that auto creates taxonomy terms – Can it auto delete them as well?
- Get custom taxonomy value of post and output posts in same taxonomy
- Adding new terms to custom taxonomy
- Search and filter with custom field in taxonomy
- is_tax not working for custom taxonomy
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
- wp_add_object_terms cant recognize a post ID