Use get_terms()
to get the child terms of a given term. You need to feed the specific term id to either
parent
(integer) Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string.
OR
child_of
– (integer) Get all descendents of this term. Default is 0. Note: the difference between child_of and parent is that where parentonly gets direct children of the parent term (ie: 1 level down), child_of gets all descendants (as many levels as are available)
EXAMPLE:
Get all descendants of term ID 80
(Requires PHP 5.4+)
$terms = get_terms( 'portfolio_category', ['child_of' => 80] );
For only first level children, change child_of
to parent
Related Posts:
- Exclude a category from WP_Query
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to build a complex page structure
- How to filter custom post types by custom category taxonomy
- Is there a way to use regular categories with custom post types?
- How to list all categories and tags in a page?
- remove support for ‘Categories’ for a custom post type
- Glossary with Custom Post Type
- Custom-Taxonomy as categories: Remove “most-used” tab?
- Filter get_categories() for taxonomy term in WordPress
- Add filter to wp_list_categories and query what type of taxonomy-terms it use?
- Custom edit post column – category not showing
- Custom post type taxonomy template
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Taxonomy structure of Sport site
- Display Custom Category (taxonomy) Name in Custom Post Type
- get_categories() for only CPT
- Show Post Count of a Category
- custom taxonomy archive by year
- Get categories and descriptions from custom post type
- Combining custom post type and post category
- Querying Term Posts in Loop
- Weird problem happening with custom taxonmy when creating/updating posts
- Insert HTML inside link in a walker
- Set menu active state for custom posttype and category, given custom taxonomy term
- Display all posts in main category and 1 subcategory
- Posts from all the categories are being displayed instead of particular category
- Conditional Statement custom post type category
- Categories sorting
- Allow user to set custom order to a list of custom taxonomies?
- get_category_parents for custom post type taxonomy
- wp_list_categories() – current-cat class also inside posts?
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Show a Category X’s custom post type on Category X archive page?
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Hide parent categories when clicked, and show it’s childs
- Limit amount of posts made within a custom taxonomy
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- How to edit this code to get the categories in achieve page?
- Hierarchy and access control for Custom Post Types (CPT)
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- How to get custom posts sub category link
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- WP the_posts() on single-cars.php get category link
- in_category for custom post types
- Get parent category id from child category page for custom taxonomy
- How to add current custom taxonomy slug to body class
- List Posts By Custom Taxonomy
- get_category_link() for custom post type does not include custom slug rewrite?
- How to Display Posts From Category Within a Custom Taxonomy?
- Disable custom taxonomy on admin bar
- Why does my taxonomy have a category style div id?
- Targeting categories in custom fields
- Listing all slugs?
- category list with cutom post count
- The Difference Between Categories and Tags and Taxonomies and Terms
- Include custom post type custom taxonomies in Categories widget
- Custom post type categories gives 404 error
- Custom Post Type Custom Archive Page Not Working
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Custom post types category
- Get terms for a specfic post from multiple taxonomies in custom post type
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Retrieve Custom Taxonomies with Description and Slug
- Custom post type specific category box
- Custom Taxonomy Taxonomies of Same Name point to first created URL
- how to organize my categories or should I do custom post types for some?
- Advanced archive url structure (category, tag and date)
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- How to divide Subcategories into pages of parent category wordpress
- Custom front-end form for adding post – Category problem
- How to show related posts of category on post within custom posttype
- How to set “section categories”?
- Create custom post type categories
- Show Custom Post Type based on Category on Archive Page
- Set a Default CPT taxonomy by taxonomy id
- How to manage a dynamic multi-level page hierearchy system?
- Categories manage
- Custom category taxonomy – archive page not showing up
- Help with Travel Guide Setup
- Custom post types not displaying per category
- Custom post type category archive URL redirects to home page
- Help with Multi Level Category Archive Page
- Dropdown switching subcategories portfolio
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Display 2nd category, only once, as sub-heading, in the loop
- Post Editor: display categories from current post type taxonomy only?
- Get a list of categories ids
- Trying to create hierarchy between 3-4 custom post types
- Customize category URL
- Display a custom post type list by taxonomy term
- Return Custom Post Type Categories
- Remove slug from Custom Category Permalink + dual-category permalinks
- Highlight specific menu item when custom post is page
- Is it possible for post and custom post type to share a category base slug?
- How to add categories to a custom post type using wp_insert_post($new_post);