Skip to content

Max image with should respect contentWidth & wideWidth of theme.json #5339

@fabiankaegy

Description

@fabiankaegy

Expected/Desired Behavior

When using a block / hybrid theme that contains a theme.json file the settings.layout.contentSize & settings.layout.wideSize sizes should be used to determine the maximum width attribute that is added to images.

Actual Behavior

Currently the width gets defined by the $content_width variable which is no longer needed / used in themes that have a theme.json. (See documentation: https://developer.wordpress.org/themes/basics/theme-functions/#content-width)

// Constrain default image sizes to the theme's content width, if available.
if ( $content_width > 0 && in_array( $size, array( 'thumbnail', 'medium', 'large' ) ) ) {
$_max_w = min( $_max_w, $content_width );
}

Because of this block themes that don't define the old $content_width variable get the fallback value of 1024px applied which leads to blurry images when the align wide / align full option is used on an image.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions