[wp-trac] [WordPress Trac] #29646: wp_insert_attachment() doesn't allow to add post_parent for orphan attachments

WordPress Trac noreply at wordpress.org
Sun Sep 14 18:48:14 UTC 2014


#29646: wp_insert_attachment() doesn't allow to add post_parent for orphan
attachments
----------------------------+--------------------
 Reporter:  dikiy_forester  |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  4.0.1
Component:  Media           |     Version:  4.0
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+--------------------

Comment (by jesin):

 Problem caused by [changeset:28579] when `wp_insert_attachment()` was made
 as a wrapper to `wp_insert_post()` in ticket [ticket:21963].

 Patch [attachment:29646.diff] hardcodes the values of `$defaults` and
 assigns the value of `$parent` to `$data['post_parent']`.

 It also includes a unit test which

 1. Creates an attachment
 2. **Asserts that the attachment is an orphan**
 3. Creates a post
 4. Sets this post as the parent of the attachment
 5. **Asserts that post_parent of the attachment has changed**

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


More information about the wp-trac mailing list