WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lets say i created 2 Different Primary Menus (in the Appearance > Menu .. section). Then in the (Theme Location > Primary Navigation) Section, i can set 1 Menu to be activated.

So how can i switch between these Primary Menus at the runtime (Programmatically from the Frontend .. WITH A BUTTON CLICK or something) ?

share|improve this question
up vote 1 down vote accepted

you can do it on the clientside, if you output both menus and change the visibility on the click of the button via javascript.

if you want to do this on the serverside, you could make another template or a if to output the menu you want to show to the user.

the only thing you have to change here is the $args in calling wp_nav_menu( $args);

share|improve this answer

An easier thing to implement is to use menu parameter in place of theme_location when calling wp_nav_menu & then accepting the 2 menus id's from the user separately (in theme options maybe?)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.