Order get_terms by term meta

get_terms supports a meta_query which calls a new WP_Meta_Query parameter as you can see here. To query your terms with your desired meta, you could change your function call to something like this: $args = array( ‘taxonomy’ => ‘categoria-de-productos’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘hide_empty’ => false, ‘hierarchical’ => false, ‘parent’ => 0, ‘meta_query’ … Read more

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