You have to tell the browser to change the address in some way.
A simple javascript solution is to put the item URL into the value attribute, and trigger the address change when the option is selected.
Replace:
$output = str_replace('<li', '<option', $output);
With:
$output = str_replace(
'<li',
'<option value="'.$item->url.'" onchange="window.location.href=this.value"',
$output);
Related Posts:
- Any docs for wp_nav_menu’s “items_wrap” argument?
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Bootstrap dropdown nav pills not working with wp_nav_menu()
- Show child pages by menu order using Superfish Dropdown menu?
- Bootstrap drop down menu with wp_nav_menu
- How do I give class to the dropdown sub-menu in the wp_nav_menu?
- How to Create a Custom WordPress Navigation Menu with the Code?
- WordPress 3.5 dropdown menu
- Menu item with no page, but with dropdown
- Add css class to dropdown
- Using a shortcode to create a dropdown menu from wp_nav_menu list items
- Menu in left side don’t appears with dropdown
- getting the current sub item out of total sub items in a given dropdown (custom walker)
- How to add html attributes to the “ul” html tag with “wp_nav_menu” function?
- How to remove dropdown from wp_nav_menu
- styling wp_nav_menu – horizontal, sub-menu drop downs
- Replace the slug of parent pages with # [closed]
- wp_get_archives doesn’t take effect from css or html
- Adding archive years to my menu
- Nav menu classes ‘has-dropdown’ but no ‘active’
- Drop Down menu expanded by default (on front page) [closed]
- Custom menu – different submenu for first menu item
- Dropdown primary navigation menu not working
- Is there any way to change the CSS class applied to 2nd level sub menu ul’s?
- WordPress menu issue – if there are child links partents won’t click
- How can I create this menu with wp_nav_menu()?
- Responsive Dropdown Menu
- Foundation Scripts not loading (custom theme)
- Reveal hidden submenus on page load – Twenty Fifteen theme
- No indication of menu
- wp_dropdown_nav function to list menu items
- How to make a drop down menu with categories
- How to add an tag when a menu item is a dropdown(or has a sub-menu) [duplicate]
- How to add posts with thumbnails to my dropdown menu?
- Should I custom code drop down menus or use a wordpress plugin?
- Keeping my Sub Menu open when hovering on its list items
- Jquery dropdown menus working locally, but not in WordPress [duplicate]
- Add a page to a subscribers account
- What is the best way to incorporate responsive dropdown navigation menu into custom theme?
- Menu items do not “open” when mouse hover over them?
- Icon not shown in Dropdown menus in Twenty Seventeen Theme
- Display a portion/ branch of the menu tree using wp_nav_menu()
- Display only page specific sub menu items using Custom Walker
- non-clickable placeholder in the menu
- Ways to give a wp_list_pages menu link specific class names?
- I want remove last after wp_nav_menu
- Add log in link to menu in Twenty Twelve
- wp_list_pages – show pages immediately 1 level below current level
- Add within the output of
- Where to update the Static Pages Blacklist for Multisite Install?
- How to create a category menu?
- Vertical Sidebar Menu Parent and Child not displaying correctly [closed]
- Hide Menu items base on capability
- How to show Home Page link in WordPress Menu and how to add an icon to this?
- Remove li from wp_nav_menu
- How do you return a menu with the menu name?
- do_action appearing outside of menu?
- You do not have permission to create Navigation Menus – Twenty Twenty-Two theme
- Walker class conditional based on parent menu item label or custom css class
- ‘wp_get_nav_menu_items’, when fired inside of the ‘wp_update_nav_menu’ hook, returns old menu items, instead of new
- Menu custom link not working for external site
- Walker Class – Check if menu item has description and if so add class to li
- Multiple languages menus problem
- How to override menu markup?
- Recent Posts widget missing current_menu_item class
- Static site menu with multiple ul’s to wp menu
- How can I make wp_nav_menu() support tags?
- Filter to hook into menu items and add a custom attribute
- Adding a tag to wp_nav_menu
- Adding Pipes to Menu Output
- select a main navigation menu per user type from multiple main navigation menus
- wp_nav_menu li item empty
- Custom Menu in Themes not working even in Twenty Eleven theme
- Add a menu metabox to post edit page
- Setting or plugin for showing submenus horizontally under the main menu, and keep them after selection
- New wp menu menu styling
- (Mobile) Hamburger menu disappeared from a page (only one)
- Hiding menu on specific pages
- Bootstrap Menu bar shows up a toggle in Desktop Mode
- For a menu custom link (without a link) a “#” is appended. Can this just be blank, i.e. NO link?
- sidebar navigation problem with child pages not all display.?
- How to point menu to my homepage
- save_post() on Menu Save
- code to add an extra selection to the menu editor
- update_post_meta breaking wp_update_nav_menu_item
- Menu dropdown disapears behind slider
- Generate Submenu based on Parent Page using If Statement
- Building a menu from a large number of pages?
- how to change single post link
- Any simple way to show 10 previous pages by id to current page in links as a menu
- Pass $item->description to start_lvl
- How do I remove a menu from a theme?
- Access CSS Classes specified in Menu options
- How to output the menue structured for tabbed navigation?
- Custom Menu based off custom header
- Adding an additional menu in WordPress
- Making current_page_item work with wp_list_pages in sidebar on post pages
- My Menu Disappears on my Custom Link Homepage on Mobile
- How to centre menu items on horizontal nav bar? (e.g. make margins equal) [closed]
- How to change mobile menu (toggle) icon in WordPress – Full Site Editing?