Sounds like you want wp_dropdown_categories()
to me:
$tax_args = array(
'taxonomy' => 'location',
'orderby' => 'name',
'show_count' => 1,
'hierarchical' => 1,
);
wp_dropdown_categories($tax_args);
Related Posts:
- get_posts assigned to a specific custom taxonomy term, and not the term’s children
- Get the the top-level parent of a custom taxonomy term
- Custom taxonomy, get_the_terms, listing in order of parent > child
- Determine Term depth
- How to enable hierarchical permalinks for hierarchical taxonomies
- Get taxonomy name of current post
- Determine if Term has Grandparent/Great-Grandparent
- Custom Taxonomy Relationship (ex: plant classification)
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- How to fix a double slash in custom permalinks with hierarchical taxonomy’s?
- How to include parent terms in hierarchical taxonomy URLs?
- How to set hierarchical terms to a post using wp_set_object_terms
- Help building array hierarchically with taxonomies (to get posts)
- Hierarchical display of custom taxonomy
- How to get parents of custom taxonomy, as what get_category_parents() do?
- How to get a list of taxonomy terms which are being used only within certain post types?
- Taxonomies: display hierarchical parent list
- How to Query Database for posts with certain Taxonomy Term
- Display hierarchical subterms of custom taxonomy based on depth
- Can I limit term selection to one plus parent?
- Redirect all child taxonomy to its parent
- How do I display a list of posts under all hierarchical children of the current taxonomy?
- How can I populate a select element with terms from a custom taxonomy and filter post results?
- Register a pre defined tree of taxonomies
- Get parent and children taxonomy in different dropbox
- How to make custom post taxonomy looks like regular categories?
- Hierarchical Taxonomy Terms Select Menu Output with selected=”selected” Set
- Custom Taxonomies not retaining hierarchy while importing from one site to another
- Rewrite rules for varying nested terms of custom taxonomy
- Front-End Custom Taxonomy Tag Select
- Multi-select field for Taxonomy can’t save the value
- List Posts For Terms Of A Custom Taxonomy For Any Post Type
- Using custom taxonomies to display hierarchical URLs?
- Changing select options based on previous select with PHP & AJAX
- how to store values in database at hierarchical view
- Multiple Custom Taxonomy Dropdowns Lists
- tax_query: Don’t show posts with parent term when they have a corresponding child term applied
- Display a specific hierarchical level of a specific custom taxonomy
- SEO Title Tag and Meta Description for custom taxonomy
- WordPress Multiple Taxonomy Query
- Need help understanding a rewrite with multi-level taxonomy
- Taxonomy term breadcrumb; how?
- Determine if Term has Grandparent/Great-Grandparent
- Getting grandchildren of a post with a specified custom taxonomy?
- List child terms and posts in the current term
- Display Parent and child taxonomies in seperate drop downs [duplicate]
- More than one Hierarchical Taxonomy and SEO
- Best approach of implementing multi-select/checkboxes for taxonomies?
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Get value in custom field with taxonomy [closed]
- Get second level terms of custom taxonomy
- Modify Term Update Redirection
- How to get first post in a category of a custom taxonomy
- How to get the singular name of a custom taxonomy?
- Archive template for taxonomy terms
- pre_get_posts OR relation between taxonomy and author
- Custom Fields and performance
- get_the_term_list without specific category
- Add Category Name to REST API
- Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- Is it possible to create exclusive custom taxonomy?
- Custom Taxonomy Archive BUG
- how does get_term_by know which term to return when the same term appears twice in a hierarchical taxonomy?
- Changing stylesheet depending on custom taxonomy terms
- Taxonomy with_front causes all
- Why is my taxonomy template not shown?
- How Can I Change a Taxonomy URL Based On The Originating URL?
- I have 2 post types i need to show the post type contents in 2 select boxes [closed]
- How To Assign “Taxonomy per Taxonomy”?
- How to add a Rewrite Rule / Category Structure
- How to have two different versions of a tag/category/taxonomy archive page?
- Rewrite Rule Working for all but one of the taxonomies created
- Get custom taxonomy for visual composer shortcode but not working?
- How to Display a menu only if it has Posts in Custom Menu?
- how does the wordpress rest API work
- Why is flush_rewrite_rules mandatory after registering custom taxonomies?
- tax_query not working
- wp_query not resetting, last post hanging
- Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead
- how to get term id from current post type instead of name
- Display children category images
- Dropdown taxonomy lists in admin menu
- How to define %category% for custom taxonomies?
- How to Create Multi selection search Form using Default WordPress Category Terms, and Custom post Types Taxonomies Terms?
- How do I get the correct URL?
- Query all images with certain tag in media library using visual portfolio plugin
- Problem with wp_list_category with custom taxomy
- Restrict viewing of posts by category, user role
- Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta
- Does a codex exist for creating meta boxes in taxonomy
- Run next query based on first query’s term
- Get the original menu item name string instead of the label
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- How to query posts that are not related to any term of a taxonomy?
- Function code problem
- add_action with variable as a part of the $tag string
- How to display Custom taxonomy on custom post listing page [duplicate]