Skip to content

image_default_link_type option is ignored in media & text block  #60222

@skorasaurus

Description

@skorasaurus

Description

Really minor issue but the option image_default_link_type isn't applied to the media & block.

The site-wide option image_default_link_type; when its value is set to file, the image block (and the gallery block) automatically links to the full-size file immediately after the image is selected in the media library or uploaded; without any further action by the content editor, as shown below.

image

This behavior doesn't happen in the media & text block although you could expect it to.
This discrepancy is probably a result of the media & text block not being an image block inside of it.

Step-by-step reproduction instructions

  1. set the option so that images are automatically linked to the full image file by default:
    in wp-cli wp option update image_default_link_type file

could be done in a theme
with (I didn't verify that this callback function works)

add_action( 'after_setup_theme', function() {
    update_option( 'image_default_link_type', 'file' );
});
  1. add media and text block;
  2. within it, upload a new image or select image from image library
  3. go to the block's toolbar and open the link button

Screenshots, screen recording, code snippet

No response

Environment info

WP 6.4;
Gutenberg 17.9

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Media & TextAffects the Media & Text Block[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[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