Gallery images don't display when original post associated with image is trashed
|Reported by:||nmoinvaz||Owned by:|
I've looked through a bunch of tickets so forgive me if this is a duplicate but I couldn't find anything like it on here.
The problem I believe is that you can assign 1 image to different galleries in different posts. If you delete the original post on which the image was first attached, then the other posts with galleries that are associated with that image will no longer display the full-sized image.
I have attached a video screencast showing the problem on one of our test sites.
- Create post A
- Upload image X
- Create gallery in post A with image X
- Save post A as a draft
- Create post B
- Create gallery in post B with image X
- Delete post A
- View post B
- Click on image X and view full-sized image
I tracked down the issue query.php around ~ line 2700 where it does a check to see if the the attachment is public/trashed. When viewing post B it instantly gets the attachment's post_parent which is now trashed.