Skip to content

Commit 8224530

Browse files
Check if block theme
1 parent 164809c commit 8224530

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/auto-sizes/includes/improve-calculate-sizes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ function auto_sizes_filter_image_tag( $content, array $parsed_block, WP_Block $b
140140
* @return string|false An improved sizes attribute or false if a better size cannot be calculated.
141141
*/
142142
function auto_sizes_calculate_better_sizes( int $id, $size, string $align, int $resize_width, string $max_alignment ) {
143+
// Bail early if not a block theme.
144+
if ( ! wp_is_block_theme() ) {
145+
return false;
146+
}
147+
143148
// Without an image ID or a resize width, we cannot calculate a better size.
144149
if ( 0 === $id && 0 === $resize_width ) {
145150
return false;

0 commit comments

Comments
 (0)