The selected
parameter just defines which option is selected when the select field is rendered.
it’s an optional parameter that defaults to the current category or 0
$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
(https://developer.wordpress.org/reference/functions/wp_dropdown_categories/)
This function is for rendering a category drop down, but you can override it to work with any taxonomy. It looks like your code is using an arbitrary taxonomy rather than a ‘category’. So you need to provide the value.
In your code where is the value for $taxonomy
coming from? What php template is this code running in?
Related Posts:
- Exclude custom taxonomy from search results and archive pages
- Search for tags
- Filter taxonomy terms using multiple id in the edit-tags.php
- If search matches taxonomy
- Check for taxonomy archive on search results page
- How to make tags show up in search results?
- Modify output of wp_dropdown_categories to add term IDs to each option
- Search Media by taxonomy
- Show only first child in dropdown
- WP Search using taxonomy terms
- Change searching from world level to first letter
- Is possible hide hierarchical select dropdown created by jetsmartfilters? (only visual issue)
- Including taxonomy in searches
- Custom dropdown search form that allows users to select option B based from Option 1
- Display taxonomy terms when adding a link in the admin
- How to show a hierarchical terms list?
- The Difference Between Hierarchical and Non-Hierarchical Taxonomies?
- How to perform unit testing on proposed patches in Trac?
- Attaching taxonomy data to post with wp_insert_post
- Need a simple but complete example of adding metabox to taxonomy
- How to get taxonomy term of the current page and populate queries in the template
- Can the default “post tags” taxonomy be renamed?
- Custom columns for taxonomy list table
- Custom Taxonomy WP_Query for All Terms in a Taxonomy?
- Custom taxonomy list page?
- How to add a default item to a custom taxonomy?
- Remove the category/taxonomy description field?
- Taxonomy dropdown metabox in the back-end
- How can I create a taxonomy meta-box with search suggestions but no new terms input?
- Add ‘Description’ to taxonomy ‘Quick Edit’
- Why does get_term() require taxonomy? Are term_ids not unique?
- How does Woocommerce store variation attributes, and how can they be retrieved per-variation? [closed]
- tax_query in get_posts() not working?
- What is wp_insert_term “alias_of” arg for?
- Automatically Assign Parent Terms When A Child Term is Selected
- Custom Taxonomy as Dropdown in admin
- Search custom taxonomy term by name
- get term by id without taxonomy
- How to organize and cache additional data associated with terms?
- Using pre_get_posts to set posts per page, how do I?
- get a specific taxonomy term name
- wp_set_object_terms() Fails to Set Terms
- wp_set_object_terms() — prevent overwrite?
- Taxonomy terms sort by… Last name!
- List Hierarchical Term List with Count with Related Term
- Is there a way to set singular/plural labels for taxonomy term names?
- WordPress – Creating multiple versions of the same single-customtype.php depending on selected taxonomy categories
- Better way to enforce category hierarchy in post_categories_metabox?
- get_terms() How many is TOO many?
- Child Terms not Displaying on the Taxonomy Term Admin Screen
- get_terms with posts that have a different taxonomy with term x
- How to display child term of current term’s parent taxonomy?
- List all taxonomy terms / Show links if posts are attached, else names
- List taxonomy terms as links
- check if tag exists in wp database
- Sorting custom taxonomy causes menus error
- How to overwrite a specific parameter in a core taxonomy?
- Filter results with custom field values and dropdown
- Set a cookie in WordPress, using a select form and Jquery
- How to add terms to taxonomy with wp_insert_terms?
- How to update taxonomy custom field with wp_update_term()?
- Get_term_by only returns one item from array
- How to set a Preset category for custom post types?
- How to find objects by terms
- Can we have same term slug in different taxonomies?
- Is there any difference between post in child term and child & parent terms?
- Sort posts by number of matched terms
- Add additional data to a specific taxonomy term when used in a post
- Set default (auto) slug prefix for Tags
- How to have “the most used tags” taxonomy always expanded?
- Add Thumbnail to wp_list_categories()
- Get parent and first child taxonomy terms?
- How to add automatically keyword to taxonomies when a post published, and assign them to the post
- Display the number of published posts for each custom taxonomy term?
- Display Custom Taxonomy in Sidebar in Two Columns
- Get wordpress taxonomy archive and sort by year
- Create and move terms for taxonomies
- Display Post by taxonomy and taxonomy child
- Display Post by taxonomy and taxonomy child if exist
- How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?
- Fatal error: Call to undefined method stdClass::filter() in wp-includes\taxonomy.php on line 805
- WP native tag suggest metabox. How does it process tag id?
- Missing term_id and term_taxonomy_id when adding a term using wp_insert_term() function
- Update all posts at once
- Change order of WordPress tag cloud
- Retrieve taxonomy terms in order of their post’s date?
- How to get the last term from taxonomy?
- Count posts for each taxonomy term for each month
- Custom taxonomy archive – No posts found [closed]
- Display parent taxonomy name and list child taxonomies below it?
- List post from current taxonomy children
- What hooks/filters are there to alter selected terms on post save?
- Count argument in get_terms has no effect on ouput/doesn’t work
- Filter blog archive by category in URL
- How can I remove links from the function “get term list”?
- Alphabetical order in taxonomy.php
- Get Term names from WP Term Object
- tax_query: What to pass when I want to have all terms?
- Custom Roll/Custom Post Type – Can’t Select Categories
- Let users create a new custom taxonomy entry from frontend (without creating a post)