Skip to content

Featured Image: "post-thumbnail" media size may be needed #70526

@t-hamano

Description

@t-hamano

Description

Noticed while reviewing #70514

In the Featured Image block, four resolutions are available: Thumbnail, Small, Medium, and Full.

Image

Also, immediately after inserting this block, the "Full" resolution will be selected in this dropdown, and the HTML will look like this:

<!-- wp:post-featured-image /-->

Furthermore, if you select a resolution other than full and then select full again, the HTML will look like this:

<!-- wp:post-featured-image {"sizeSlug":"full"} /-->

In the editor UI, "full" is selected in both cases, but this difference in HTML is important for front-end rendering, because the Featured Image block uses the "post-thumbnail" size as a fallback media size:

$size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail';

This means that if your theme defines this media size via the set_post_thumbnail_size() function, the size of the image rendered on the frontend may change.

Step-by-step reproduction instructions

  • Activate the Twenty Fourteen theme. This theme defines 1038 x 576 size as the post thumbnail.
  • Prepare a large-sized image and upload it to the media.
  • Open the post and set the image as the post featured image.
  • Insert two Post Featured Image blocks.
  • For one of the Post Featured Image blocks, change the Resolution to something other than full, then change it back to full again.
  • Your content HTML should look like this:
    <!-- wp:post-featured-image /-->
    <!-- wp:post-featured-image {"sizeSlug":"full"} /-->
    
  • Save the post and view the page.
  • Note that the two images have different media sizes.

Screenshots, screen recording, code snippet

aa2ec31317b1c385c4e31f773143b1c1.mp4

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Block] Post Featured ImageAffects the Post Featured Image Block[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions