[wp-trac] [WordPress Trac] #56855: Featured Image bug in 6.0.3
WordPress Trac
noreply at wordpress.org
Thu Oct 20 21:17:37 UTC 2022
#56855: Featured Image bug in 6.0.3
-------------------------------------+---------------------
Reporter: raduiason | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.1
Component: Media | Version: 6.0.3
Severity: minor | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------
Comment (by Bernhard Reiter):
Replying to [comment:10 Bernhard Reiter]:
> FWIW, I've now filed a
[https://github.com/WordPress/gutenberg/pull/45163 PR] against Gutenberg
to carry over that change. (We need it to escape that output; we'll then
need to solve this issue here separately -- likely via the patches that
folks have already provided.)
Note that that change will be part of WP 6.1 RC3 next Tuesday. To simulate
the impact already, apply the following patch to `trunk`:
{{{
diff --git a/src/wp-includes/blocks/post-featured-image.php b/src/wp-
includes/blocks/post-featured-image.php
index de5683b297..495c8ec534 100644
--- a/src/wp-includes/blocks/post-featured-image.php
+++ b/src/wp-includes/blocks/post-featured-image.php
@@ -64,7 +64,7 @@ function render_block_core_post_featured_image(
$attributes, $content, $block )
if ( ! empty( $attributes['scale'] ) ) {
$image_styles .= "object-
fit:{$attributes['scale']};";
}
- $featured_image = str_replace( 'src=', 'style="' .
esc_attr( $image_styles ) . '" src=', $featured_image );
+ $featured_image = str_replace( '<img ', '<img style="' .
esc_attr( safecss_filter_attr( $image_styles ) ) . '" ', $featured_image
);
}
return "<figure {$wrapper_attributes}>{$featured_image}</figure>";
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56855#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list