Home › Forums › Support › swap navigation menu through a hook This topic has 2 replies, 2 voices, and was last updated 6 years, 9 months ago by Tom. Viewing 3 posts - 1 through 3 (of 3 total) Author Posts July 19, 2017 at 3:46 pm #351929 Ash How do I swap menu through a hook conditionally? I have to swap depend on cookie so plugins out there can’t handle. I’ve done with another theme but this don’t work with GP. function my_wp_nav_menu_args($args=''){ if(!empty($_COOKIE['translator-translator-jquery-to']) && $args['theme_location']=='primary'){ $args['menu']='MAIN2'; } return $args; } add_filter('wp_nav_menu_args','my_wp_nav_menu_args'); July 19, 2017 at 5:30 pm #351951 Ash I think it still works with GP. Might be because of cache or hook priority… July 19, 2017 at 11:41 pm #352054 TomLead Developer Lead Developer Yep, that should work regardless of which theme you use 🙂 Author Posts Viewing 3 posts - 1 through 3 (of 3 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In