Skip to content

Image Block: When adding an existing image within a post, explore "attaching" the image to the post if it isn't already attached #66663

@andrewserong

Description

@andrewserong

What problem does this address?

Follows #12753

This issue was raised as part of a much earlier issue (#12753) in this comment: #12753 (comment)

Worth noting here that some work would need to be done to ensure Gutenberg added images are properly seen as attached.
Right now, you can have an image in a Gutenberg post or page but the status in WP Admin > Media will still show unattached.

In Gutenberg, if we upload an image to a particular post, then the uploaded image will be "attached" to that post. I.e. if you go to the media library, you can see that it's attached to the post:

Image

However, if we simply select an image from the media library and add it to a post or page, it does not "attach" it to the post.

To verify, add some images to a site via the media library. Then, go to create a post or page. Add the image to the post or page and publish. Then, go to the media library, and the image will still say Unattached under the Uploaded to column:

Image

What is your proposed solution?

When a user adds an image from the media library to a post or page, if the image is not already attached to any post (is unattached), then attach the image to the post.

That's the proposal here! Does this sound good, or are there any potential gotchas, concerns, issues that could arise by introducing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] ImageAffects the Image Block[Feature] MediaAnything that impacts the experience of managing media[Type] EnhancementA suggestion for improvement.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions