Make WordPress Core

Opened 3 years ago

Closed 21 months ago

#53159 closed defect (bug) (wontfix)

Media aren't attached if uploaded from libray and are attached if uploaded from post

Reported by: ellimstom's profile ellimstom Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.7.1
Component: Media Keywords: reporter-feedback close
Focuses: Cc:


It seems that medias keep unattached if they are uploaded from library before adding them to post or custom_post. If they are uploaded from post or custom_post, it's working fine.

Here are the reprocedures:

  1. Working one: Upload from post:
    • 1. create a post
    • 2. click to add featured image
    • 3. upload an image and attach
    • 4. Publish post
    • 5. Go to library and filter unattached
    • Result: the uploaded image don't show up
  2. Issued one: Upload first:
    • 1. go to library and upload an image
    • 2. create a post
    • 3. click to add featured image
    • 4. Publish post
    • 5. Go to library and filter unattached
    • Result: the uploaded image shows up

The same behaviour has been found while attaching images to Woocommerce products with CSV import. It's been tested with Automattic support and they have the same issue on their side.

Change History (4)

#1 @desrosj
3 years ago

  • Component changed from General to Media
  • Keywords reporter-feedback close added

Hi @ellimstom,

Welcome to Trac!

Can you clarify whether you are using the block editor or the Classic Editor? I am able to reproduce the behavior, but only using the block editor.

If you are indeed using the block editor, this will need to be reported as an issue upstream in the Gutenberg GitHub repository. I'm adding a suggestion to close this ticket as reported-upstream pending that confirmation.

I did some digging to see if this was intentional, and I couldn't find anything. I'm going to link several related items though:

It's worth noting that originally, the attached status just signified that an image was uploaded to a post, so post_thumbnails and attachments embedded in posts can inconsistently be attached/unattached in ways that make technical sense, but the attached/unattached relationship has grown over time and has become quite confusing and inconsistent.

This behavior was initially introduced into the Classic Editor in [22843].

#2 @ellimstom
3 years ago

Hi @desrosj,

I guess I'm in block editor, but I don't really use it because I installed a page builder. I discovered this by adding a feature image from backend (see screenshot).

The same occurs while adding product image in Woocommerce where there is no block editor (only classic editor).

I understand that originally, the attached status just signified that an image was uploaded to a post, but it is far better to know whether or not an image is not attached and so unnecessary in filesystem (a lot less images to deal with when you have hundreds). Maybe there is a media library improvement scheduled...

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

21 months ago

#4 @antpb
21 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Hi ellimstom! Thanks for making this issue. After review in the Media component meeting we found that this is the intended behavior of the Media Library. Being that this data is very much pointed as a 1 to 1 relationship, it would be undesired to overwrite that data every time the same image is used as feature. Also, folks may be using this attached property in specific ways being that it is a more underutilized function and changing the behavior to update that attached property based on featured image will likely be unpredictable.

I'm going to close this ticket as this suggestion has been closed prior for similar reasons.

Note: See TracTickets for help on using tickets.