Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :
img
Home / Technology / Software Development / How to disable srcset in WordPress

How to disable srcset in WordPress

/
/
/
1630 Views

WordPress 4.4 has a new feature which let browsers to select the best image according to the device screen size from a set of images resized by WordPress for different screen sizes. It help to minimise loading time and also bandwidth because if you are using iPhone, it will only load images for iPhone screen instead of big images which are for desktop screens.

As this is the new feature and many plugins are not optimised to use this feature so, plugins may misbehave (i.e. yith-woocommerce-zoom-magnifier on thumbnail selection where it don’t change the image but show the image on mouse hover). So, the quick solution is to disable this feature until new compatible version of plugin is released. You can use following code to do it.

function shiota_disable_srcset( $sources ) {
return false;
}
add_filter( 'wp_calculate_image_srcset', 'shiota_disable_srcset' );

  • Facebook
  • Twitter
  • Google+
  • Linkedin
  • stumbleupon

Leave a Comment

Your email address will not be published. Required fields are marked *

It is main inner container footer text