Disable Secondary Navigation Mobile Menu

Sometimes the secondary navigation only has a few links and doesn’t need to collapse into a mobile menu.

You can disable the mobile menu and only display the menu items with a function and a little CSS.

First, the function:

add_action( 'wp_enqueue_scripts', 'generate_dequeue_secondary_nav_mobile', 999 );
function generate_dequeue_secondary_nav_mobile() {
    wp_dequeue_style( 'generate-secondary-nav-mobile' );

Learn how to add PHP here.

Then, the CSS:

.secondary-navigation .menu-toggle {
      display: none;

@media(max-width: 768px) {
    .secondary-navigation {
        text-align: center !important;
    .secondary-navigation ul {
        display: block;
    .secondary-navigation .sf-menu>li {
        float: none;
        display: inline-block !important;

Learn how to add CSS here.