• Resolved pudde

    (@pudde)


    hiya,

    i’m writing a function which will return the jpg attachments of a post:
    // start snip
    $images=&get_children(‘post_type=attachment&post_mime_type=image&post_parent=’.$post->ID);
    print_r($images);
    // end snip

    this works well until i edit this post in wp-admin. if i remove the images from the post, this piece of code will still return the images as the children. all images i’ve ever uploaded to a post is returned, even if the latest revision doesn’t contain pictures at all.

    i’ve removed these attachments in phpmyadmin for now but i can’t keep doing it for my client when i’ve handed the site over.

    anyone figured out a way around this, or is this a bug in 2.7?

Viewing 3 replies - 1 through 3 (of 3 total)
  • if i remove the images from the post,

    When you say “remove,” do you mean you have deleted them from that post’s gallery or just that they don’t appear in the body of the post? Because the former is what really deletes them.

    Thread Starter pudde

    (@pudde)

    i’ve deleted them from the body of the post. the text area no longer contains any references to these images. (i’ve even looked in phpmyadmin and there are no img tags in the body fields of the latest revision). can you replicate this behaviour?

    many thanks,

    peder

    Thread Starter pudde

    (@pudde)

    wow do i feel stupid… i read your message again and wow. i have been developing wp sites since 2.3 and never understood how the gallery works until now. sorry for wasting everyones time.

    /p

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_children returning deleted attachments’ is closed to new replies.