How to remove WordPress srcset tag for old posts images prior WP 4.4

User avatar
axew3
w3all User
w3all User
Posts: 1971
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

How to remove WordPress srcset tag for old posts images prior WP 4.4

Post by axew3 »

To solve all problems reported here:
https://make.wordpress.org/core/2015/11 ... press-4-4/

Code: Select all

function srcset_remove( $sources ) {
	  return false; // this will nullify srcset added to img tag on images since wp 4.4 
	  // todo: return correct value for the wp_calculate_image_srcset filter
}

add_filter( 'wp_calculate_image_srcset', 'srcset_remove' );
You may would like to run this, only for old posts with date prior your WP update to 4.4 or >