Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#10651 closed defect (bug) (invalid)

Problem with image added "by hand" and get_children(...image...)

Reported by: metabaron Owned by:
Milestone: Priority: high
Severity: major Version: 2.8.4
Component: Media Keywords: media
Focuses: Cc:


I'm using the latest version of wordpress mu 2.8.4

Start adding two images to your newly create bug (just to be sure, I tested on blank wordpress mu site).
Let's say they are named "a.jpg" and "b.jpg"

Get a very simple page:

<?php if (have_posts()) : while (have_posts()) : the_post();

$images =& get_children( "post_type=attachment&post_mime_type=image$post_parent".$post->ID);

foreach ( $images as $attachment_id => $attachment ) {
$temp=wp_get_attachment_image_src( $attachment_id,$size='full' );
<p><a href="<?php the_permalink() ?>"><img style="border:10px solid #000000;" height="90%" width="90%" src="<?php echo $temp[0]; ?>" alt="<?php t\
he_title(); ?>" /></a></p>

Now, create one post and insert "a.jpg" image using the 'add media' button. Do the same in a new post but, this time, add "b.jpg" using 'add media' button.
So, you should see both images

Now, by hand, in the second post, change "b.jpg" for "a.jpg" and refresh your page: the images are always the same a and b, not a and a at it should be ...

And, if you look at 'Library', you see that "a.jpg" and "b.jpg" are pointing to there respective post when "b.jpg" should point nowhere ...

This seems to be a bug somewhere in the code when adding an image "by hand" and it was functional before in the previous version

Change History (2)

#1 @metabaron
11 years ago

  • Severity changed from critical to major

I realized that this bug might be related to the fact that, from time to time, if you add an image using the "add media" button from within the post, the image is not attached to the post ...
Example: http://wordpress.org/support/topic/295142?replies=1

#2 @azaozz
11 years ago

  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Attachments (images) are attached to the post that was open when they were uploaded. If uploaded from the Media Library screen they are not attached anywhere until they are inserted in a post. However any image can be inserted in any post, not only in the parent.

Note: See TracTickets for help on using tickets.