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
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Combine two taxonomies in a hierarchical tree
- Reflect nested categories in appearance > menus
- Remove child products from woocommerce category page [closed]
- How to Override default update_count_callback for category
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- How to select product category while adding new product in woocommerce? [closed]
- How to get the number of child categories a specific parent category has?
- display woocommerce all category title on home page
- 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
- Custom page for WooCommerce’s /product-category/
- 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
- How to export/import categories and keep their IDs?
- How to use wp_category_checklist()?
- 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
- WooCommerce IF statements not working
- products nested by subcategories in a current category archive
- Change existing taxonomy settings when using custom taxonomy
- How to get the id from the custom category?
- category filter doesn’t work in WPML
- How can i insert term in a specific language of Polylang?
- Hide woocommerce category name from specific pages
- Remove product category placeholder image (Woocomerce)
- Categories for each brands
- Unwanted Duplicate Product Categories in WooCommerce
- Customize WordPress widget – Product Category
- WordPress/Woocommerce only show category in shop to a single role
- WooCommerce – How to show specific category first-rest of products-specific category last
- Filtering *out* a taxonomy from the admin post list
- category image taxonomy
- How to “group” (categorize) the Pages together?
- Is There a Difference Between Taxonomies and Categories?
- Custom taxonomy/category order
- How can I improve this taxonomy treating approach?
- get_terms function not returning anything
- How to display parents category and child category separately for a specific post?
- How to display a value inside a post with a specified category from a category custom field? [closed]
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- How to access deleted term inside delete_product_cat action
- Apply WordPress function on specific woocommerce product categories only
- Woocommerce filter function not updating
- How can i change what one category displays?
- Get posts of a custom post type from category from taxonomy?
- Show different menu on each woocommerce category page
- Same menu for different taxonomies to reach different content
- Change categories count to include media attachments
- How to get selected taxonomy or category ID if using custom walker?
- How could I write a get_categories_by_year() function?
- Get posts in a subcategory of a chosen parent
- Natural sort / ordering wp_dropdown_categories
- Best way to categorize/populate a magazine style layout
- Displaying posts of given category
- WooCommerce shared categories
- Automatically adding tags and categories into Post Excerpt for searching
- How can i add service category here? [duplicate]
- Show subChild categories
- WordPress 5.4 and higher: Filter posts by category 1 AND category 2 in API requests
- How to set the same base url for two different taxonomies?
- How to show given products only using product id array from specific category page in woocommerce
- Limit categories to hierarchal depth of 2
- Shop Category Pages missing s
- WooCommerce REST API not returning the default products category
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- WordPress Portofolio Conditional Templating – functions php
- Parent Category and Subcategory default text generated with category
- Post List by category and under custom taxonomy
- 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
- How to display products with multiple conditions, product_id and category_id
- Create duplicate category page with content variations
- Renaming default category taxonomy?
- Categories and Tags Conflict after Woocommerce Installation
- How to get related category/categories in WordPress archive page
- How to add a post with new Taxonomy without assigning to default category?
- Problem importing categories and sub-categories
- list taxonomy based on taxonomy
- Show parent-child relationship for categories in the wordpress admin
- Woocommerce – Display product category of product in Orders page
- Changing Woocommerce categories programatically
- Order Categories by Character Count
- Restricted category in Woocommerce [closed]