To set the default value for the category dropdown, you need to pass it as a parameter for the function. Like so,
$dropdown_args = array(
'selected' => 2,
);
wp_dropdown_categories( $dropdown_args );
Related Posts:
- Dropdown category field inside repeatable metabox
- Function to return true if current page has child pages
- Cleaning up WordPress to improve performance?
- List of all theme customizer control types?
- exclude multiple terms using get_terms() function
- How to preserve PHP modifications while upgrading WordPress?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Change comments form title on a page by page basis
- Allow authors to post only in categories they create in WordPress
- Add custom field to attachments in a specific category
- How to Populate the list of custom post type categories
- Php string not working in WordPress Functions.php [duplicate]
- Setting up the child theme so as to enable right-to-left WordPress?
- delete an array element when its date expires
- How to add default images into theme customizer image control?
- Overriding a theme redux file in child theme
- Problems with function on function.php
- Use template for posts with a particular category grandparent
- Check if Product is in a Specific Category in Functions.php
- How to break down importing of feeds
- Woocommerce – remove product from category
- PHP can I add line numbers to file_get_contents()
- get current product name in functions.php
- Setting custom canonical urls
- get post based on category chosen in drop down – The ajax method
- Swapping wp_dropdown_categories function with wp_category_checklist
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Converting HTML Template to WordPress Theme
- Filter Select results based on selection
- How to check if a meta value has already been assigned to any user?
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Get page that displays all children of taxonomy parent
- how to save selected option in variable for rest api category filter
- Modify custom field input data before creating a new post
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Need help enqueueing webfonts
- how to show only specific category for a template
- Redirect to another page using contact form 7? [closed]
- Dilemma of Populating all the categories in a drop down list
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Edit the_category (); for a hierarchical display
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Displaying posts based on category
- Isotope Drop Down Categories Filter Function
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Create page template via functions.php?
- How to get current post category details inside “loop”?
- Show all tags within a category?
- Post not populating for custom post type based on category selection
- List post by title length
- How do i wrap woocomerce attribute in list?
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Is there a hack for using is_page() within the function.php file?
- Custom Taxonomy Select Menu: Setting default option value?
- go to home page when i select default in select-box
- Customize field names in backend profile edit page through function.php [duplicate]
- WP insert post Redirect after function has executed
- How to set value selected using select2 jquery plugin
- WP-Bakery – Add custom colors to buttons with template colors
- I need to display posts in subcategory beside posts in main category
- Trying to update Woocommerce meta values
- Display Visual Composer shortcode if a post belongs in specific categories
- update_user_meta as multiple value but with same meta key
- Get parent category name when only child category is applied to a product
- How to move a post from one category to another
- Precheck fields when I add a new post
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Delete post meta by serialized meta value
- Notice: Undefined variable
- Hide a specific category title from displaying on site
- Populate Posts based on category selected using AJAX that means without page refresh
- All categories options or All categories not Populating
- Remove node from multisites?
- Automatically refresh page if widget is added to page?
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- PHP drop down menu for my get_category child of
- PHP get_category() function redeclared
- Where can I find the declaration of `$_wp_theme_features`?
- How do I routinely extract the thumbnail of the most recent post?
- Showing the project type in HREF
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Get category id for a custom category and display it in a class
- Check if values exists DB
- Trying to see if page is category or single and displaying title with appropriate heading tag
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to add button to top of theme customizer?
- How can I clear the theme mod settings?
- Display a list of users with avatar filterable with alphabets
- Displaying categories
- Select area and checkbox data is not saving?
- How to insert the first letter in uppercase [closed]
- Contact form with dynamic dropdown and filter
- WP Custom tables query
- Add multiple HTML attributes to an Elementor button
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- Exclude a category ID from the following function