Get term SLUG by term ID

I have bit of trouble understanding your question. Taxonomy (like category) slug or term (like uncategorized) slug? get_term_children() works with terms so I will stick with that. Try this: $term = get_term( $id, $taxonomy ); $slug = $term->slug;

How to only list the child terms of a taxonomy and not their parents?

This should work for you: $taxonomyName = “age”; //This gets top layer terms only. This is done by setting parent to 0. $parent_terms = get_terms( $taxonomyName, array( ‘parent’ => 0, ‘orderby’ => ‘slug’, ‘hide_empty’ => false ) ); echo ‘<ul>’; foreach ( $parent_terms as $pterm ) { //Get the Child terms $terms = get_terms( $taxonomyName, … Read more

Get The Post Type A Taxonomy Is Attached To

If we peek into the global $wp_taxonomies variable we see the associated object types. There might be better ways to do this or even core functions, but you could try the following: function wpse_172645_get_post_types_by_taxonomy( $tax = ‘category’ ) { global $wp_taxonomies; return ( isset( $wp_taxonomies[$tax] ) ) ? $wp_taxonomies[$tax]->object_type : array(); } then for the … Read more