Assuming you want to show the terms of just one taxonomy at a time, then this will produce what you’re looking for:
function my_theme_get_child_terms(){
$return = '';
$current_term = get_queried_object()->term_id;
$term_info = get_term($current_term);
$sub_categories = get_term_children( $current_term, $term_info->taxonomy );
$return .= '<h2>' . $term_info->taxonomy . '</h2><ul>';
foreach ( $sub_categories as $cat ) {
$term = get_term_by( 'id', $cat, $term_info->taxonomy );
$return .= sprintf( '<li><a href="https://wordpress.stackexchange.com/questions/247649/%1$s">%2$s</a></li>',
esc_url( get_term_link( $cat, $term_info->taxonomy ) ),
esc_html( $term->name )
}
$return .= '</ul>';
return $return;
}
You need to put the above code inside a relevant template file
. E.g. taxonomy.php
or index.php
.
Related Posts:
- Identical custom taxonomy slugs for same hierarchical children
- Get Comma Seperated Taxonomy Linked Terms and Last Child Separated By “&” Instead Of Comma
- How add body_class from wp_termmeta
- relation OR instead of AND – Filtered term ID’s in loop
- Get URLs for AJAX Filter Checkboxes WordPress
- Prevent function from triggering on current page
- Taxonomy On Index Page
- Way of getting queried loop before the query with a filter hook?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- How to Filter the Custom term loop based on dropdown
- Publish/Update post is changing image links from file url to post url
- Categories of custom taxonomy don’t show any posts
- Getting different functions data while using while loop in wordpress
- Disable auto-resizing of uploaded images, but only for certain filename
- How to make custom column Admin>Users sortable?
- How to Filter custom post type by taxonomy?
- Create a new query in function.php to filter blog posts
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- Get Current Post ID in functions php, meta query filter
- Output and filter data from a XML url
- Add to cart php not working [closed]
- Is possible add icon in title posts only in specific tag?
- Move ‘current-menu-item’ class on #adminmenu li from Posts to Pages for Taxonomy Edit Screen
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- create filter in functions.php
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- Limit length of first excerpt in the loop
- How to filter $content in shortcode function
- Full Custom Post Type List Organised by two Taxonomies
- Insert image in WordPress with HTML5 tag and caption function
- How to construct function for applying filter?
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Adding an external HTML link to a post thumbnail
- Replace a menu with widget or a custom template file programmatically
- woocommerce change currency per category [closed]
- Default Custom Field Value Automatically Update
- Post loop for all taxonomy terms
- Multiple Loops Meta Data
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- Get list of all custom tanonomy id
- Run wp_kses_decode_entities on atom feed?
- Filtering out the #more anchor link that gets produced by
- Can’t filter wp_get_attachment_link
- Different Category system needed for the Custom Post Type
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Redirect to another page using contact form 7? [closed]
- append to existing parent theme function
- Why doesn’t is_page(id) work in functions.php?
- Custom taxonomy.php not working
- Add Element as a Filter to the_content
- Override the WordPress core function wp_referer_field
- Modify post filter to set custom number of posts per page and exclude child posts
- Make wp_link_pages() suitable for Twitter Bootstrap markup
- How can I add a filter for specific categories on functions.php?
- How to add custom JavaScript in functions?
- Setting a default text for excerpts of a particular category
- How to edit the Tags within the image file URLs?
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Retrieve a value from Yoast SEO to use to set a default twitter card image honoring overrides
- Can’t properly set the_title add_filter to show short_URL
- Add_filter when value is no variable?
- The Loop not looping?
- How to add_filter html template to middle of content
- (Woocommerce) Order by price when entering specific category
- Filter an WordPress Function in (general-template.php)
- Trying to get property of non-object in shortocde
- While loop with an exception after a count is reached
- Redefine function arguments before rendering
- How to edit classes in body tag?
- How do I pull excerpts from pages?
- Output loop to function return?
- Filter nav menu items HTML tags and wrap inner text with span
- Possible to hook into Media Library preview File column and use a custom image?
- Output a specific link in WordPress post if the single post’s category’s name contain certain word
- How can I add a class to a nav li depending on URL?
- issue with if/elseif in_array inside foreach loop display only one post
- Modify gform_other_choice_value for specific form and specific field in Gravity Forms
- Hierarchical taxonomy list with modificated term links
- Combine embed_oembed_html and oembed_result
- login_headertitle is deprecated since version 5.2.0
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- Possible to merge these two functions?
- How to display the_archive_title() and the_archive_description() – “weird” interaction
- Filter to wp_list_authors
- How to add custom li item to wordpress menu
- Native gallery custom html output
- My custom taxonomy is only displaying 1 of 3 terms
- Genesis Framework: How to exclude a specific author from archive custom loop
- Problem with calling custom function in a foreach loop
- The_content and Preg_replace in loaded Iframe [closed]
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- Get term slug by term id and then explode it
- Using functions.php to include code that’s processed inline
- Loop through custom taxanomy in post and display custom fields from posts
- Functions Filter Question [closed]
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- Add Adsense code between job listings – wp job manager plugin
- Get Attachment Category Name