[wp-trac] [WordPress Trac] #8721: attach logic is overenthusiastic: inserting a single item from Media Library sets post_parent of every item listed in Add Media overlay

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 25 02:48:55 GMT 2008


#8721: attach logic is overenthusiastic: inserting a single item from Media
Library sets post_parent of every item listed in Add Media overlay
--------------------------+-------------------------------------------------
 Reporter:  dhalbert      |       Owner:  anonymous
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  2.8      
Component:  General       |     Version:  2.7      
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 I am getting spurious '''Attached to''' settings when inserting Media
 Library items into a post.

 How to reproduce:

 Add a bunch of files to the Media Library . (I added a bunch of existing
 pdf files using the '''Add From Server''' plugin.) All are inserted into
 table wp_posts with post_parent=0, so they are unattached.

 Create a new post, and click on the '''Add Media''' icon, which brings up
 the '''Add Media''' overlay.

 Choose the '''Media Library''' tab, which shows the first 10 items in the
 Media Library. Click on '''Show''' for one of these: the entry expands.
 Edit the Title slightly (may not be necessary), and then click on
 '''Insert into Post'''.

 The '''Add Media''' overlay goes away. Finish editing the post and publish
 it.

 Now browse the Media Library. You will discover that the '''Attach To'''
 column shows that all ten of the items mentioned above are listed as
 attachments of the post you just created. The post_parent for all ten
 items shown in the Media Library list has been set to the id of that post,
 even though you only inserted one item from the list of ten.

 So the attach logic mistakenly thinks everything in that Media Library
 list should be attached, instead of just the inserted item.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8721>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list