From fecc1d2aa66c2fb2c6379fb47de5d7cd71f01f8c Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 17 Nov 2022 11:28:16 +0400 Subject: [PATCH] Post Featured Image: Only get the post title when rendering alt text (#45835) --- packages/block-library/src/post-featured-image/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/block-library/src/post-featured-image/index.php b/packages/block-library/src/post-featured-image/index.php index 068b7eeac6899..dfb03c5a89065 100644 --- a/packages/block-library/src/post-featured-image/index.php +++ b/packages/block-library/src/post-featured-image/index.php @@ -27,12 +27,11 @@ function render_block_core_post_featured_image( $attributes, $content, $block ) $is_link = isset( $attributes['isLink'] ) && $attributes['isLink']; $size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail'; - $post_title = trim( strip_tags( get_the_title( $post_ID ) ) ); $attr = get_block_core_post_featured_image_border_attributes( $attributes ); $overlay_markup = get_block_core_post_featured_image_overlay_element_markup( $attributes ); if ( $is_link ) { - $attr['alt'] = $post_title; + $attr['alt'] = trim( strip_tags( get_the_title( $post_ID ) ) ); } if ( ! empty( $attributes['height'] ) ) {