Remove Menu Assets

Knowledgebase Docs » UberMenu 3
USEFUL? 2
UberMenu 3

To remove all UberMenu assets from a page (stylesheets, scripts, custom styles, Font Awesome, Google Maps, etc), you can unhook the asset loaders. Here’s some example code:

add_action( 'wp', 'um_remove_assets' );
function um_remove_assets(){
  remove_action( 'wp_enqueue_scripts' , 'ubermenu_load_assets' , 21 );
  remove_action( 'wp_enqueue_scripts' , 'ubermenu_pro_load_assets' , 22 );
}

To conditionally remove the assets from specific pages, you can add in a check, for example, to remove the assets only on the home page:

add_action( 'wp', 'um_remove_assets' );
function um_remove_assets(){
  if( is_front_page() ){
    remove_action( 'wp_enqueue_scripts' , 'ubermenu_load_assets' , 21 );
    remove_action( 'wp_enqueue_scripts' , 'ubermenu_pro_load_assets' , 22 );
  }
}

If you would like to also remove the custom CSS generated from the Customizer, please see Remove injected CSS (styles in site head)