I am building a custom webshop and I am trying to remove the photoswipe style documents but I can’t seem to get rid of them, I tried a couple of "solutions" that I found online but they are not working. This is what I tried so far in the functions.php:
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-lightbox' );
remove_theme_support( 'wc-product-gallery-slider' );
and
add_filter( 'woocommerce_enqueue_styles', 'wpf_dequeue_styles' );
function wpf_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['photoswipe-css'] );
unset( $enqueue_styles['photoswipe-default-skin-css'] );
return $enqueue_styles;
}
and
wp_dequeue_script('photoswipe-css');
wp_dequeue_script('photoswipe-default-skin-css');
Can someone help me finding the solution? I don’t have any images in my webshop so I do not need these scripts.
2
Answers
You can
remove_theme_support
usingafter_setup_theme
action hook.You can
wp_dequeue_style
usingwp_enqueue_scripts
action hook.If anyone is still looking for the answer to this then the correct code would be :