Don’t need get_term_children()
at all. Just loop through get_the_terms()
to get what’s needed.
global $post;
$brands_id = get_term_by('slug', 'brands', 'product_cat');
$terms = get_the_terms($post->ID, 'product_cat');
foreach ($terms as $term) {
if($term->parent === $brands_id->term_id) {
echo $term->name;
break;
}
}
Related Posts:
- Woocommerce get category image full size
- Programmatically create product category and add thumbnail in woocommerce
- Set post categories to include parents when setting child category
- Get WooCommerce product category list in functions.php
- Restrict retrieved terms by category?
- Categories and Tags Conflict after Woocommerce Installation
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- get_terms name__like list categories according to letter
- How can I select a primary category?
- Reflect nested categories in appearance > menus
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Excluding posts from a category but only if they’re not in multiple categories
- Remove child products from woocommerce category page [closed]
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Getting the sub category
- How to select product category while adding new product in woocommerce? [closed]
- Update wordpress post terms programatically
- Remove word “Category” from WooCommerce product page [closed]
- Get a list of Terms for a specific category
- Filtering search results
- WooCommerce change category url and product base
- Output link to category from WP_Query loop of woocommerce products
- display woocommerce all category title on home page
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- Add Icons to the Product Category Sidebar Widget WooCommerce
- How to get product count with respect to categories in WooComerce
- Custom page for WooCommerce’s /product-category/
- get_cat_ID() not wokring
- How do I get a list of all categories that a given user has written blog posts for?
- Display child categories in WooCommerce
- WooCommerce duplicate sub categories and product slugs
- WooCommerce IF statements not working
- Linking products to categories
- Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages
- Omit specific product categories from WooCommerce shortcode
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- Limit number of terms that a custom taxonomy can save per custom post type
- Inserting Category programmatically
- Hide woocommerce category name from specific pages
- Hide woocommerce category name from specific pages
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- Pagination is not working properly in Product Category/Tag pages
- How to recreate a copy of a product category in WooCommerce? [closed]
- Categories for each brands
- WordPress/Woocommerce only show category in shop to a single role
- WooCommerce – How to show specific category first-rest of products-specific category last
- Woocommerce custom category page with pagination [closed]
- Display custom taxonomy attached to the post on post single page
- wp_dropdown_categories not showing option as selected
- Ive got a term (get_term_by) but now I want to filter it by a category it is in?
- Get a count of how many times a term or a category is used in posts
- Get Categories Where Taxonomy Equals ‘n’
- Display sibling categories on category page
- Count tags for a specific category
- Do not show sub categories in the loop on archive-product.php
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- why get_the_post_thumbnail( the_ID()) echos extra post id
- How to access deleted term inside delete_product_cat action
- Apply WordPress function on specific woocommerce product categories only
- Filter WooCommerce archive pages by an additional category
- Grandchild Term Things Grandfather Term is It’s Parent
- set terms to category and subcategory
- Woocommerce filter function not updating
- How can i change what one category displays?
- Two Sections on Woocommerce Catergory Page [closed]
- Woocommerce search form with category select
- Show different menu on each woocommerce category page
- wp_delete_term or wp_delete_category?
- WooCommerce shared categories
- Displaying Single Product Page Parent and Child Category
- List taxonomy terms assigned to a post in hierarchical view
- How to show given products only using product id array from specific category page in woocommerce
- Ordering terms whilst in loop
- Shop Category Pages missing s
- WooCommerce REST API not returning the default products category
- How to show WooCommerce Categories on ‘shop’ page instead of products?
- Show the parent taxonomy by creating shortcode in woocommerce?
- Can’t display posts by filtering categories using isotope.js
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- Is there a reason to put a product in both the Child and Parent Categories?
- WooCommerce showing active product categories on single product page
- List non-empty categories from a custom post type
- How to display custom fields as table in Woocommerce
- How do I merge WooCommerce categories with the same name?
- product_cat image url from database
- Woocommerce product catalog, products with different description
- WooCommerce – Get products from category right before deleting category
- No results found for second level category
- How to display products with multiple conditions, product_id and category_id
- get_terms sort order with child categories of varying depth
- Getting a sub category based on a category name
- Getting Post Tags From Certain Categories
- How to get related category/categories in WordPress archive page
- Problem importing categories and sub-categories
- Modify functions.php to add a term ‘uses-theme’ set to theme name on post save
- Woocommerce – Display product category of product in Orders page
- Changing Woocommerce categories programatically
- Woocommerce Force the category choice before creating new product? [duplicate]
- Taxonomy term RestApi data 10 rows limitions
- List the category tree of all the product_cat categories