Skip to content

Instantly share code, notes, and snippets.

@robneu
Created July 29, 2016 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robneu/4c3081b6c03828e675a50b0b99843ebb to your computer and use it in GitHub Desktop.
Save robneu/4c3081b6c03828e675a50b0b99843ebb to your computer and use it in GitHub Desktop.
<?php
add_action( 'wp_enqueue_scripts', 'prefix_disable_wp_featherlight_woocommerce', 10 );
/**
* Remove all required scripts and styles on WooCommerce pages.
*
* @since 0.1.0
* @access public
* @return void
*/
function prefix_disable_wp_featherlight_woocommerce() {
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
add_filter( 'wp_featherlight_load_css', '__return_false' );
add_filter( 'wp_featherlight_load_js', '__return_false' );
}
}
@chrisblakley
Copy link

chrisblakley commented Apr 5, 2021

I know this is five years old, but this is helpful. Instead of disabling the filter hooks themselves, another thing to try is directly deregistering the handles:

add_action('wp_enqueue_scripts', function(){
	if ( function_exists('is_woocommerce') && is_woocommerce() ){
		wp_deregister_style('wp-featherlight');
		wp_deregister_script('wp-featherlight');
	}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment