Dequeue scripts and styles for Mega Menu on certain pages?
-
Hi
Great plugin! I have a question about ability to dequeue scripts and styles for Mega Menu on certain pages.We only use the menu on certain pages of the site, not a couple of our landing pages, and as such, want to remove the styles and scripts from loading to speed up the loading time of the page.
function home_page_remove_scripts(){ if ( (!is_admin()) && is_front_page() ) { wp_dequeue_script( 'maxmegamenu' ); wp_dequeue_script( 'colorbox' ); wp_dequeue_style( 'maxmegamenu' ); wp_dequeue_style( 'megamenu-css' ); wp_dequeue_style( 'colorbox' ); } } add_action( 'wp_print_styles', 'home_page_remove_scripts', 999 );This isn’t working (you can see above I am using different variations of calling the styles).
Can you advise as to the best way to approach this?
Thanks in advance from all the users of your plugin focused on performance! 🙏
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Dequeue scripts and styles for Mega Menu on certain pages?’ is closed to new replies.