PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/block-library/post-featured-image.php +4 -1 23.5.3 → 24.1.0 View file →
@@ -43,9 +43,12 @@
43 43 $has_width = array_key_exists( 'width', $attributes ) && null !== $attributes['width'] && '' !== $attributes['width'];
44 44 $has_height = array_key_exists( 'height', $attributes ) && null !== $attributes['height'] && '' !== $attributes['height'];
45 45
46 46 if ( ! empty( $attributes['aspectRatio'] ) ) {
47 - $extra_styles .= esc_attr( safecss_filter_attr( 'aspect-ratio:' . $attributes['aspectRatio'] ) ) . ';';
47 + // If there's no non-default value set, let the image's width and height attributes determine its intrinsic aspect ratio.
48 + if ( 'auto' !== $attributes['aspectRatio'] ) {
49 + $extra_styles .= esc_attr( safecss_filter_attr( 'aspect-ratio:' . $attributes['aspectRatio'] ) ) . ';';
50 + }
48 51 $extra_styles .= 'width:100%;';
49 52 }
50 53
51 54 if ( $has_height ) {