You can use the function wp_dropdown_categories()
instead of wp_list_categories()
, if you dont need to use the list function.
wp_dropdown_categories()
seems to be working just like the list function. So first just try and replace these two functions.
$terms = wp_dropdown_categories( array( ...
Read about it in the codex here.
Related Posts:
- Replacing the NavWalker dropdown element
- Custom Loop through category menu to include sub categories
- Filter Select results based on selection
- How to pick the default selected value in wordpress dropdown?
- how to save selected option in variable for rest api category filter
- How to use wp_nav_menu to create custom dropdown menu?
- go to home page when i select default in select-box
- Dropdown category field inside repeatable metabox
- How to list categories by page id in wordpress
- Open WordPress Page from selected option dropdown
- Mega Menu Walker
- Displaying Logged-In User Name in WordPress Menu
- Drop down+sort blog posts date added/most popular
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
- How to show only parents subpages of current page item in vertical menu?
- How to Remove Parents Category Permalink from Posts
- Looking to exclude blog posts from category Previous/Next buttons
- How can I add a class to a single menu item?
- Custom widget using get_categories select menu dropdown
- Remove all nav menu classes ( but keep useful ones… )
- Second Navigation inside header
- How to exclude specific category from the get_the_category(); array
- Can’t extend some core classes
- combine Code 1 with Code 2
- Multiple WordPress Menus that will only display all pages
- How to make drop down post title
- Menu — How to add “current-menu-grand-ancestor” css class
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Proper syntax or method for keeping url in modified isotope / category links
- Menu Limitations
- Automatically adding new post categories to menu
- selected option if current category is the value
- get_template_part based upon post’s category
- Alert Bar section within WP loop is displaying even though there are no posts
- Different post styles depending on category
- Custom Menus: dynamic highlighting problem with custom home link
- Define specific category name in PHP
- Category title output before opening title tag
- Include Parent Term in wp_list_categories
- Register a menu – Error Header
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Add value to new attribute inside WordPress menu items
- How to get category name or ID by post?
- How to hide posts of a specific custom category in WordPress?
- Add new post in existing categories using wp_insert_post
- Menu Items fail to save correctly, cause reset of related page metadata
- Dropdown menu for categories
- How to change logo by category
- Problem with custom loop and wp_list_pluck [closed]
- Listing titles and custom fields of entries within subcategories
- random display categories – change url
- Get the name of menu item with wp_nav_menu
- Output category list inside array
- Output only links using wp_nav_menu()
- How to add aria role and schema markup to custom walker container
- Nav menu from plugin to theme
- Extend Menu Walker Output
- Define category ID using get_post_meta
- how to add a div inside wp_page_menu
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Remove submenu item from list
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- conditional: if is page, and all subpages
- wp nav menu: show submenu below li item
- Remove the Tag from wp_nav_menu
- Styling an “active” link outside of WordPress default menu
- Dynamic menu with custom post types
- Counting number of posts in multiple (sub)categories using shortcode
- I need to display posts in subcategory beside posts in main category
- Order category posts by last word of custom field
- Change category thumbnail size
- Get nice name of category from slug (remove dashes of category)
- How to make only the valid active page of a multilevel menu active with – “.nav li.current-menu-item a”?
- Replace jQuery with PHP or CSS for Customized WordPress wp_nav_menu
- admin panel – How to remove “delete” button from category editing page
- Multiple Tag Filtering
- Polylang and template files
- Notice: Undefined variable
- Redirect User when they click Menu Option
- Get Child of Child Pages in custom Menu
- Show subcategory name selected in specific category woocoommerce
- Difference between “Walker_Nav_menu” and “walker”
- Custom content using in_category
- Vertical Menu for one page only
- Need Quick Help With Product Category Page
- Editing existing pre-created menus in PHP
- Rearrange get_categories array compared to another array
- Active class not working on custom menu link using add_menu_page
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- Query seems to be duplicated
- Top menu disapears in Category Pages when filtering using ACF
- Remove the_content From Loop
- Dropdown Menu for Query_Posts
- Category List in Theme Options Page
- Code that displays images – images get shown multiple times
- Product Category Page in Full Width
- Remove Unused Menu Locations
- Display all categories (with link) of custom post type – WordPress
- Custom nav with bootstrap dropdown