Site logo

Archived topic

Disable menu.min.js?

3 replies · Started by Anders on March 14, 2022

Viewing posts 1–4 of 4

How do I disable this from loading? I have disabled header and menus on the landing page totally. And I do not want to load that asset.

/wp-content/themes/generatepress/assets/js/menu.min.js

Hi there,

try this PHP Snippet:

add_action( 'wp_enqueue_scripts', 'tu_remove_menu_scripts', 50 );
function tu_remove_menu_scripts() {
    if ( is_front_page() ) {
        wp_dequeue_script( 'generate-menu' );
        wp_dequeue_script( 'generate-dropdown' );
    }
}

Thanks David, that worked perfectly.

Glad to hear that!

This archived topic is closed to new replies.