Restrict add_image_size to Woocommerce Post type only
-
Hi
WC add a few image size,
– woocommerce_thumbnail
– woocommerce_single
– woocommerce_galleru_thumbnail.Now if I upload a normal post or an image through another plugin/cpt, then these sizes are also created.
I really would like to limit the creation of images size to the relevant post type with something like this:
if( get_post_type() !== 'product' ) { remove_image_size( 'woocommerce_thumbnail' ); remove_image_size( 'woocommerce_single' ); remove_image_size( 'woocommerce_gallery_thumbnail' ); remove_image_size( 'shop_catalog' ); remove_image_size( 'shop_single' ); remove_image_size( 'shop_thumbnail' ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Restrict add_image_size to Woocommerce Post type only’ is closed to new replies.