Hot answers tagged taxonomy
WordPress will cache all terms for taxonomies attached to all post types in the query result set by default - well, so long as you haven't set either cache_results or update_post_term_cache to false (codex). So calling get_the_terms etc. within the loop will not hit the database. However, wp_get_object_terms will hit the database as it by-passes WordPress' ...
Use get_term_children() $term_id = 2; // use get_queried_object()->term_id; to get the current term id $taxonomy_name = 'mypages'; // use use get_queried_object()->taxonomy; to get the current taxonomy name $countchildren = count (get_term_children( $term_id, $taxonomy_name )); echo $countchildren;
You cannot query users by taxonomy. You will need to rethink your system. What would I do? Keep the taxonomies but use these only to output choosable values - wp_dropdown_categories() Save the selected value AS user meta, NOT AS taxonomies - update_user_meta() Now you can query users by that value - WP_User_Query() Example: This code would go to the ...
Only top voted, non community-wiki answers of a minimum length are eligible