[wp-trac] [WordPress Trac] #50675: Media: migrate the data from the attachment post of the parent image when saving an edited image

WordPress Trac noreply at wordpress.org
Fri Jul 17 18:50:23 UTC 2020


#50675: Media: migrate the data from the attachment post of the parent image when
saving an edited image
----------------------------------------+-----------------------
 Reporter:  azaozz                      |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  5.5
Component:  Media                       |     Version:  trunk
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  rest-api
----------------------------------------+-----------------------

Comment (by azaozz):

 Replying to [comment:6 spacedmonkey]:
 > I am not sure what you mean here. At alt is used to describe an image.

 Not always. The alt text may be a description of the image in some cases
 but in other cases should be contextual, i.e. describe the image's meaning
 in the surrounding text. See https://www.w3.org/WAI/tutorials/images
 /decision-tree/. Also, the image alt may be used to "redirect" to the
 image caption, example: https://www.w3.org/WAI/tutorials/images/complex
 /#structurally-associating-the-image-and-its-adjacent-long-description-
 html5.

 > The current alt doesn't care for context

 Right, #47456 for fixing this. Seems better to not add more places that
 need fixing :)

 Don't mind copying the alt text when present, but seems the chances that
 the old alt text is "wrong" are high.

 > What about the `post_title`? Should this be copied over to the new image
 as well?

 Good point. This would create several posts with the same titles, i.e. the
 slugs will have `-1`, -2`, etc. but if the parent image's title was
 edited, the user expectation would likely be to keep it.


 > We could also look at copying over the parent id from the old image as
 well.

 Hmm, perhaps. Would prevent the need to use `get_post()` in a loop when
 needing the "grand-parent(s)" of an edited image. On the other hand that
 would make the `parent_image` an array of arrays, or perhaps can be an
 associative array `$attachment_id => $relative_file_path,`. Unsure if it's
 "worth the effort", how useful that would be.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50675#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list