Primary menu wrap


I think there is a bug in Beans. If there is created in Wordpress another menus, and I disable (not select) Primary menu in Wordpress, then is in Beans navbar primary selected, viewed last another menu, but when I delete all another menus from Wordpress, then if I disable primary menu, cant be disabled, is VISIBLE only Primary Menu( last menu which is in wordpress).

I noticed also, that when I delete all menus in Beans is automatically created Navigation menu. How to disable that in Beans , when no menues is selected, then also no menues is show in theme?


Hi Boris,

This isn't a bug in Beans, it is actually an intentional behaviour. WordPress creates a "fake" menu by default if all menus are removed but it unfortunately doesn't listen to Beans menu walker. Therefore, Beans registers a default menu properly to avoid all sorts of warnings and incorrect styling. As usual, you may change this behaviour by remove the registration as follow:

// Remove default menu registration.
beans_remove_action( 'beans_do_register_default_menu' );

// Remove Beans empty menu notice.
add_filter( 'beans_primary_menu_args', 'example_primary_menu_args' );
add_filter( 'beans_primary_offcanvas_menu_args', 'example_primary_menu_args' );

function example_primary_menu_args( $args ) {
  $args['fallback_cb'] = false;

 return $args;
}

Note that I also changed the empty menu argument in the snippet so that no notice is displayed 😉

Happy coding,


Thank you for that.

Write a reply

Login or register to write a reply, it's free!