![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/a934c6c03e6520494096327e9d47c3c6-87a1c39.jpg)
Hello all,
I'm trying to completely replace the primary menu in a specific page template, but so far I've been unable to succeed. Here are both solutions I've tried:
beans_modify_action_callback( 'beans_primary_menu', function() {
<code to generate new menu here>
});
add_filter( 'beans_primary_menu_args', function($args) {
if (has_nav_menu( 'training' )) {
$args['theme_location'] = 'new-menu';
} return $args;
});
Can someone put me on the right track, I'm stuck.
![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/c70294be72623e3f8995ee4832f8d065-87a1c39.jpg)
Hey Mark,
You shouldn't need to modify the callback. All you need is to alter the theme_location
which you almost got right. You need to make sure that you have return $args;
in your beans_primary_menu_args
callback function (after the if statement).
If you are using the offcanvas menu on mobile, make sure that you apply the change onto the beans_primary_offcanvas_menu_args
filter too 😉
Happy coding,
![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/27c64319e1ca198958613305e6ea1b6e-87a1c39.jpg)
Can primary menu be set to offcanvas menu by default? side menu instead of header .