[wp-trac] [WordPress Trac] #41445: post_parent can prevent media from embedding correctly

WordPress Trac noreply at wordpress.org
Sat Dec 18 03:48:53 UTC 2021

#41445: post_parent can prevent media from embedding correctly
 Reporter:  loboyle                              |       Owner:
                                                 |  adamsilverstein
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.0
Component:  Media                                |     Version:  4.9.4
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing dev-         |     Focuses:  rest-api
  feedback needs-unit-tests                      |

Comment (by galbaras):

 Here's a bit of a radical idea: the relationship between media and posts
 is currently many-to-one due the use of post_parent to handle it. However,
 in real life, it's many-to-many, because there's nothing stopping users
 from embedding the same item in multiple posts.

 WordPress handles many-to-many relationships via wp_postmeta, not wp_posts
 fields. Perhaps it's time to review this relationship?

 Having said that, I've seen cases where images are linked to posts (by
 plugins, e.g. within a gallery or custom field) without updating their
 respective post_parent fields. So there may be a need for a way (e.g.
 scheduled task) to clean that up.

 Subsequently, if a parent post is deleted, the association with the
 published post can still be used to check whether the media should be

Ticket URL: <https://core.trac.wordpress.org/ticket/41445#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list