Home Forums Add-ons Gallery Field Removing an image from gallery does not detach it from post


Removing an image from gallery does not detach it from post

  • If I add images to a gallery, then remove them with the “X” button next to their thumbnails on the edit post screen, they are not detached from that post. This is somewhat counter-intuitive. Is there a solution to this, and/or is this something that will be considered a bug and thus fixed?

  • Hi @tnorthcutt

    There’s no straight forward solution for this, as the gallery / image field allow you to select an image which has already been uploaded and used on a nother post.

    If ACF were to delete the image (if removed from one post), it would then remove the image from the library causing post 2 to show an error where the image used to be.

    To get around this, ACF would have to test if the image was used elsewhere in the site, etc, etc, bloat.

    Because of the amount of code involved in this, I would rather keep ACF light weight and nimble.

    Thanks for understanding


  • @elliot,

    I may not have been completely clear. I don’t mean that the image should be *deleted*; just that it should no longer be registered as an attachment on that post. If you have code that grabs all attachments for a post, then any images added to the gallery and later removed from it still get returned when fetching attachments for that post. Does that make sense?

  • Hi @tnorthcutt

    Thanks for clarifying, I’ll look into it, but the logic is already correct. If the image was uploaded on that page, it is attached to that page.

    I understand that this would help your current scenario, but it may also hurt someone elses.


Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Removing an image from gallery does not detach it from post’ is closed to new replies.