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?
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- Using wp_query is it possible to orderby taxonomy?
- “tax_query” parameter not working with WP_Query
- How do I exclude a custom taxonomy from the post loop
- How can I get only parent terms?
- How to modify a taxonomy that’s already registered
- Retrieve posts by term id custom query
- Change order of Custom Taxonomy List
- get_the_term_list without links in 3.1
- Inserting terms in an Hierarchical Taxonomy
- get_terms – only top level
- Custom taxonomy terms not showing as list Gutenberg Editor
- Altering the appearance of custom taxonomy inputs
- How to only list the child terms of a taxonomy and not their parents?
- Get term SLUG by term ID
- Is ACF being a honey trap? [closed]
- Get term name from term ID?
- Check if Current Category has Children
- How to use taxonomies on attachments with the new Media Library?
- Hierarchical taxonomy UI
- WordPress taxonomy radio buttons
- How to prevent new terms being added to a custom taxonomy?
- How to remove the tag cloud from custom taxonomy admin page?
- custom taxonomy and pages rewrite slug conflict gives 404
- Inserting a term into a custom taxonomy
- Count posts in custom taxonomy
- How to add images to taxonomies?
- Read-only taxonomy (user can assign term but can’t create or edit existing terms)
- Remove taxonomy base or term from url
- Can you add the visual editor to the description field for custom taxonomies?
- Adding Category/Tag/Taxonomy Support to Images/Media
- Add default WordPress tag meta box to User Profile
- Custom Taxonomy Endpoint Pagination using paginate_links()
- How do I get the top-level terms in a custom taxonomy?
- Check if a post has any term in this custom taxonomy?
- Query Custom Post by Taxonomy Category
- Custom columns on edit-tags.php main page
- Loop through custom taxonomies and display posts
- How do I add a custom taxonomy as an option for menus under “Appearance” > “Menus”
- custom post type taxonomy “tag” archive : no post found
- How to get WooCommerce Product Category Link by ID?
- Order get_terms using a Custom Field
- Add custom taxonomy fields when creating a new taxonomy
- get_term_children for immediate children only (not grandchildren)
- Using pre_get_posts to rewrite search query to display posts from multiple taxonomies
- Custom taxonomies capabilities
- Contact Form 7 – Populate Select List With Taxonomy [closed]
- Can’t get a custom template taxonomy page to display
- Query users by custom taxonomy and user role
- Display category posts grouped by taxonomy
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Custom Taxonomy and Tax_Query