Skip to content

Instantly share code, notes, and snippets.

@seoagentur-hamburg
Created February 18, 2016 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save seoagentur-hamburg/eb0e9443749b71e7ee43 to your computer and use it in GitHub Desktop.
Save seoagentur-hamburg/eb0e9443749b71e7ee43 to your computer and use it in GitHub Desktop.
Die Unterstützung für die neuen Responsive Images komplett entfernen.
<?php
/**
* Disable responsive image support
*/
// Clean the up the image from wp_get_attachment_image()
add_filter( 'wp_get_attachment_image_attributes', function( $attr )
{
if( isset( $attr['sizes'] ) )
unset( $attr['sizes'] );
if( isset( $attr['srcset'] ) )
unset( $attr['srcset'] );
return $attr;
}, PHP_INT_MAX );
// Override the calculated image sizes
add_filter( 'wp_calculate_image_sizes', '__return_false', PHP_INT_MAX );
// Override the calculated image sources
add_filter( 'wp_calculate_image_srcset', '__return_false', PHP_INT_MAX );
// Remove the reponsive stuff from the content
remove_filter( 'the_content', 'wp_make_content_images_responsive' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment