How to use wp_nav_menu to create a select menu dropdown?

Posted by Prem Tiwari | Updated on

You can’t do this with wp_nav_menu, because it outputs list items, and you’ll generate invalid markup with your code. Try using wp_get_nav_menu_items() instead.

A quick solution for a drop down menu with a custom walker:

In your templates use it like this:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers