Skip to content

Instantly share code, notes, and snippets.

@iworks
Created November 26, 2024 07:52
Show Gist options
  • Save iworks/b80c8f70c0cf5716f423ae0f61ee981a to your computer and use it in GitHub Desktop.
Save iworks/b80c8f70c0cf5716f423ae0f61ee981a to your computer and use it in GitHub Desktop.
WordPress: remove "sizes" attribute.
<?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