Use get_terms()
and the parent
argument.
‘parent’ (int|string) Parent term ID to retrieve direct-child terms
of.
$parent_term_id = 123;
$direct_child_terms = get_terms( array(
'taxonomy' => '[taxonomy]',
'parent' => $parent_term_id,
) );
Don’t forget to replace [taxonomy]
with whatever the taxonomy is; e.g., post_tag
, product_cat
, etc. Additional arguments for further customization here.
Related Posts:
- Include WooCommerce product to all child categories
- List just subcategory and products of active category page in Woocommerce
- How to set acf color field as background color to product category
- How to target all woocommerce categories that don’t have any subcategories in them?
- Show the parent taxonomy by creating shortcode in woocommerce?
- Get WooCommerce product category list in functions.php
- Woocommerce custom taxonomy order
- Add custom fields to Woocommerce Category Page
- Is There a Difference Between Taxonomies and Categories?
- Display All Products by Category with WooCommerce
- Check if a post is in any child category of a parent category
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- How to display non-hierarchical taxonomy as terms with checkboxes?
- get_categories for custom post type with a specific custom taxonomy attached
- Woocommerce get category image full size
- Control term order on a per-post basis
- Could not insert term into the database
- How can I add the featured image functionality to a custom taxonomy?
- Share one taxonomy across multiple blogs in 3.0 [duplicate]
- Can a Child Category Have More than One Parent?
- Combine two taxonomies in a hierarchical tree
- Weird behaviour when adding terms/term_taxonomies programmatically
- How can I select a primary category?
- wp_update_nav_menu_item() to insert categories
- Programmatically create product category and add thumbnail in woocommerce
- Admin Panel – Disable Moving Selected Terms To Top of Metabox
- How to make custom taxonomy check boxes like ‘Categories’
- Reflect nested categories in appearance > menus
- Create terms when registering taxonomy?
- Create product category and keyword search form in woocommerce? [closed]
- How to create non-unique sub-category slugs?
- How to get next previous category in same taxonomy?
- Display only deepest category on a single post?
- Remove child products from woocommerce category page [closed]
- How do I edit pre_get_post for the category the user is currently in?
- How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?
- How to Override default update_count_callback for category
- Wrap a chosen category name with div
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Display WooCommerce product categories in a 4 columns custom menu [closed]
- How to select product category while adding new product in woocommerce? [closed]
- Use get_term_children to get the sub category of a parent category for the current post
- Hide uncategorized products from the shop page
- wp_list_categories, Add class to all list items with children
- Getting WordPress custom taxonomy/category?
- Display empty taxonomy terms with get_terms()
- Remove word “Category” from WooCommerce product page [closed]
- Return category slug / title from category ID
- Filtering search results
- WooCommerce change category url and product base
- Connecting WordPress gallery to custom categories (taxonomy)
- How to get the number of child categories a specific parent category has?
- Get term by slug in Gutenberg
- What’s the difference between “parent” and “category_parent” in a WP_Term object?
- Output link to category from WP_Query loop of woocommerce products
- display woocommerce all category title on home page
- Update taxonomy value of post type in query
- How to query posts from specific authors and categories using WP_query?
- How to get the depth of a category’s subcategories
- New categories are now going to 404s
- How can I convert some categories to a custom taxonomy?
- Any way to assign Post Categories and Tags to Links?
- Add Icons to the Product Category Sidebar Widget WooCommerce
- Add Product categories to WordPress menu without losing hierarchy
- Add custom taxonomy under the category title
- Display name of the last child category
- Best way to programmatically link to multiple categories (union/intersection) [closed]
- “Reversable” and “Re-useable” Subcategories (or other taxonomic structure)
- Display “add to cart” button on every listing in product category page?
- How to get product count with respect to categories in WooComerce
- Custom page for WooCommerce’s /product-category/
- Get multidimensional array that reflects category hierarchy
- Want to hide some categories from the categories meta box in the post editor for the two specific user roles
- Getting categories id for all products in cart
- Get woocommerce catogry
- How to export/import categories and keep their IDs?
- How to use wp_category_checklist()?
- List Terms in Category
- How to get category URL with the slug?
- get_cat_ID() not wokring
- Get all sub-categories of a parent category
- Can I use get_adjacent_post for specific categories?
- Display child categories in WooCommerce
- WooCommerce duplicate sub categories and product slugs
- How to view WordPress’ default category IDs?
- Random taxonomy category list
- Taxonomy filter all children
- Set post categories to include parents when setting child category
- WooCommerce IF statements not working
- Linking products to categories
- Woocommerce category show subcategories only/omit posts for specific category
- Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages
- Omit specific product categories from WooCommerce shortcode
- products nested by subcategories in a current category archive
- WC 3.x Get categories from variable product of the cart
- Display Slug instead of Name
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- Force a user’s posts category