Add an empty option in first position:
...
echo '<option value="">All locations</option>';
$query = new WP_Query( $args );
while ( $query->have_posts() ) : $query->the_post();
echo '<option value="' . get_the_ID() . '">' . get_the_title() . '</option>';
endwhile;
...
Related Posts:
- Exclude a category from WP_Query
- Check if post type has term
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Custom taxonomy not showing up when adding a new custom post type
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- How to list all categories and tags in a page?
- WordPress custom taxonomy URL rewrite on spelling errors
- TV Show database – Best way for structuring it?
- Create an archive page for custom taxonomies
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Categories under custom post types doesn’t show properly
- Many to Many Taxonomies or rewrite rules?
- Query posts by custom post type and custom taxonomy
- Sort the main query in subcategories/terms?
- How to display the rest of categories on Portfolio filterable
- Highlight nav menu terms
- Custom Post Types, Custom Taxonomies and Permalinks ?
- get a list of posts from Custom Taxonomy
- Trying to manage templates on a blog with lots of custom taxonomies
- Display Custom Category (taxonomy) Name in Custom Post Type
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Custom post type and taxonomy permalinks – Structure
- Best action hook to create custom post and assign taxonomy terms to it on plugin activation?
- Custom Post Types relationships
- How many Custom Post Types to register?
- Display Posts in Custom Post Types Timber
- How can i skip same post from taxonomy term?
- Set menu active state for custom posttype and category, given custom taxonomy term
- How to bulk copy custom fields between custom posts?
- Getting a PHP Notice when using Pods with WPML [closed]
- Custom post type structure for posts with multiple child posts
- Search / Filter posts on Title/Content OR Tags
- Extending AZIndex plugin to use custom post types and custom taxonomies
- How to display custom taxonomies with links in filter menu?
- List custom taxonomy specific to one custom post type
- Hide parent categories when clicked, and show it’s childs
- What’s the WP way to load remaining custom posts?
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- Auto Complete Search
- permalink /category/post-name with custom post type and taxonomy
- Displaying Custom Taxonomies From Multiple Custom Post Types
- Custom post type Permalinks with hierarchical Taxonomies
- Display and register custom categories for custom post types
- Properly flush rewrite rules on plugin activation
- Adding predefined terms to a taxonomy
- Can’t use pagination with custom taxonomy
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Redirect to archive is single post has a certain term assigned to it?
- Custom query – get_the_terms not work
- Targeting categories in custom fields
- Displaying tags associated with posts in Custom Post Type
- Custom taxonomy page returns 404
- portfolio custom type tags support
- Custom taxonomies to define versions of a product
- Targeting custom post type via functions.php doesn’t work
- How to define the template for custom posts?
- Custom Taxonomy Terms in Menu lead to which page?
- Multiple archives to display parent and subcategories content
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Custom taxonomy not saving correctly
- Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy
- Custom taxonomy and post type rewrite rules
- Custom Post Type and Taxonomy Rewrite Error
- Custom Post Type Rewrite Throws Headers Sent Errors
- Custom taxonomy does not display in custom post loop
- Custom Post Type Archive Page showing as 404
- Create custom post type categories
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- How can I get the last 5 element of this tax query?
- Add other all taxonomies as meta boxes to custom post type
- How to get post type archive category title
- Remove CPT Slug with 2 taxonomies and 1 post meta
- URL with Hierarchical Taxonomies and same slug for all terms and sub-terms
- order taxonomy alphabetical
- Custom post type archive page not showing on archive-posttype.php
- Should I make a taxonomy to organize data like this?
- Display Custom taxonomy, Child terms and posts in a template Under Specific Parent terms
- Associate custom categories to different user IDs
- List all posts from custom post type by taxonomy
- archive-{custom_post_type}.php not getting recognized wordpress
- How to retrieve the permalink for a specific (custom) term?
- Values inside a custom field to determine which category posts to display
- Sort a custom post type loop by a custom taxomomy instead of chronologically
- changing post type in loop query
- Taxonomy and Rewrite Structure
- Pagination for a Custom Taxonomy
- Trying to create hierarchy between 3-4 custom post types
- Add custom taxonomies as class names to an archive page of custom post types
- Custom Post Type Base URL
- Only One Post of Custom Post Type Appearing on Template Page
- Code to show related posts (custom post type and custom taxonomy/category) is messing with other code
- register_term_meta not working
- Custom Post Type urls not working
- pre_get_posts causes Custom Posts appear under ‘Pages’ menu
- Show a wordpress custom post condtionally using a category term