0

I was wondering if there's a simple way to deselect images from uploaded to this post, but still have the images in the image library?

I uploaded some images while i was editing a post and this isn't the same as uploading images with Media > Upload.

For example, I make a post with 4 images, but overtime I don't like to use the 4 images as this particular theme auto creates a gallery from the images. When selecting insert media these images are "Uploaded to this post".

How to deselect some of these images from Uploaded to this post?

1
  • Can you explain a little more? like with examples so that people here can better understand your need Thanks:) Sep 27, 2013 at 11:35

1 Answer 1

1

You have to unattach the images from the post.
And that means setting their 'post_parent' => 0 in wp_posts database table.

The plugin Unattach and Re-attach Media Attachments does exactly this, and it uses the following command to this end:

$wpdb->update(
    $wpdb->posts, 
    array( 'post_parent' => 0 ),
    array(
        'id' => (int)$_REQUEST['post_id'], 
        'post_type' => 'attachment'
    )
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.