fourwhitesocks

how-to-disable-responsive-images-in-wordpress-4-4

Mar 1st, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. //Here is such a way, courtesy of StackExchange user Birgir Erlendsson. from post:  http://www.zigpress.com/2015/12/11/how-to-disable-responsive-images-in-wordpress-4-4/
  2.  
  3. add_filter('wp_get_attachment_image_attributes', function($attr) {
  4.     if (isset($attr['sizes'])) unset($attr['sizes']);
  5.     if (isset($attr['srcset'])) unset($attr['srcset']);
  6.     return $attr;
  7. }, PHP_INT_MAX);
  8. add_filter('wp_calculate_image_sizes', '__return_false', PHP_INT_MAX);
  9. add_filter('wp_calculate_image_srcset', '__return_false', PHP_INT_MAX);
  10. remove_filter('the_content', 'wp_make_content_images_responsive');
Advertisement
Add Comment
Please, Sign In to add comment