File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -393,4 +393,24 @@ function disable_emojis() {
393
393
}
394
394
add_action ('init ' , 'disable_emojis ' );
395
395
396
+
397
+ /**
398
+ * Disable Chromium feature that applies `contain-intrinsic-size` to images with
399
+ * `sizes="auto"` attribute. This prevents unexpected layout shifts caused by
400
+ * missing `width` and `height` attributes.
401
+ *
402
+ * WordPress 6.7 introduced a feature that automatically adds `loading="lazy"`
403
+ * to images without validating the presence of these attributes. This behavior
404
+ * can cause rendering issues, especially in Chromium-based browsers, due to
405
+ * their CSS adjustments for such images.
406
+ *
407
+ * Applying this filter disables the `auto-sizes` feature in WordPress until
408
+ * a permanent patch is released (scheduled for version 6.7.1).
409
+ *
410
+ * @link https://core.trac.wordpress.org/ticket/62413
411
+ * @link https://ericportis.com/posts/2023/auto-sizes-pretty-much-requires-width-and-height/
412
+ * @author Petr Kucera
413
+ */
414
+ add_filter ('wp_img_tag_add_auto_sizes ' , '__return_false ' );
415
+
396
416
?>
You can’t perform that action at this time.
0 commit comments