1

Process creating a gallery:

  1. I create a post with post format gallery
  2. I add images from "Add media", note I don't use "Create gallery" but insert pictures into the post
  3. update

then I have a php side

$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );

this code comes from gallery_shortcode function in media.php.

it works perfect, but when I try to delete image from post, no matter how I try it it is still there. I have not tried this but obviously deleting image permanently from media would work, but I want this images to still remain there.

how to delete them as attachments for this images from post editor?

2

A quick way to detach images is to select Media Library from the menu, Find the images you want to detach, and click the Detach link in the Uploaded to column. This will remove the value saved in post_parent for the attachment.

| improve this answer | |
  • I'm sorry but I don't see that option, can you be more specific. When I open the post and click Add Media button, I choose Media Library tab inside Insert Media tab (other tabs are: Create Gallery and Featured Image, but clearly I don't want them). I click on image but I don't have Detach option. only Insert into post – CBeTJlu4ok Dec 30 '15 at 5:36
  • It's not under Posts, it's under the Media Library menu item in the main menu. – Milo Dec 30 '15 at 5:42
  • this is what is see screenshot.co/#!/2665753f04 there is no detach button there. when I click gallery (in Uploaded to) it just brings me to that post – CBeTJlu4ok Dec 30 '15 at 6:12
  • 2
    @CBeTJlu4ok May be you need the list view of media library (not the attachment) :) – Mayeenul Islam Dec 30 '15 at 6:21
  • yaaay! thanks man. whats wrong with it, if I want to use columns, detaching is not accessible? that definitely wrong. I spend so much time just to find this damn button. – CBeTJlu4ok Dec 30 '15 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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