diff --git a/packages/block-library/src/media-text/edit.js b/packages/block-library/src/media-text/edit.js index c4749df01ee8a..5cf7928563d61 100644 --- a/packages/block-library/src/media-text/edit.js +++ b/packages/block-library/src/media-text/edit.js @@ -318,11 +318,11 @@ function MediaTextEdit( { onDrag={ imperativeFocalPointPreview } /> ) } - { mediaType === 'image' && ( mediaUrl || featuredImageURL ) && ( + { mediaType === 'image' && mediaUrl && ! useFeaturedImage && ( diff --git a/packages/block-library/src/media-text/index.php b/packages/block-library/src/media-text/index.php index eff4bb1ddaeab..f828aed645fb1 100644 --- a/packages/block-library/src/media-text/index.php +++ b/packages/block-library/src/media-text/index.php @@ -48,6 +48,7 @@ function render_block_core_media_text( $attributes, $content ) { } $processor->set_attribute( 'src', esc_url( $current_featured_image ) ); $processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug ); + $processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) ); $content = $processor->get_updated_html();