Created
November 26, 2024 07:52
-
-
Save iworks/b80c8f70c0cf5716f423ae0f61ee981a to your computer and use it in GitHub Desktop.
WordPress: remove "sizes" attribute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'wp_get_attachment_image_attributes', | |
function( $attr, $attachment, $size ) { | |
if ( is_array( $attr ) && isset( $attr['sizes'] ) ) { | |
unset( $attr['sizes'] ); | |
} | |
return $attr; | |
}, | |
10, | |
3 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment