[wp-trac] [WordPress Trac] #23434: post_parent update

WordPress Trac noreply at wordpress.org
Sat Feb 9 23:07:32 UTC 2013


#23434: post_parent update
-----------------------------+--------------------------
 Reporter:  reliability      |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:                   |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 I've tried to find similar tickets but was unsuccessful. So, I apologize
 if this is a duplicate.

 Consider the following steps:

 1. Upload an image A to the media library.
 2. Create a new post P1 and insert the image A.
 3. Create another post P2 and insert the image A.

 The post_parent property of A will be set to the id of P1. But when adding
 the image to the post P2, no new post-entry for A with the post_parent-id
 of P2 is added to the wp_posts-table.

 The effect of this is, while the image is properly displayed when the
 content of post P2 is rendered, code that retrieves images that are
 attached to P2 fails. For instance:

 {{{
 /* ... */
 $images = get_children( array( 'post_parent' => $post->ID, 'post_type' =>
 'attachment', 'post_mime_type' => 'image' ) );
 /* ... */
 }}}

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


More information about the wp-trac mailing list