Images are still visible if trashed or if their parent post is unpublished
|Reported by:||aldenta||Owned by:||aldenta|
If a post thumbnail is assigned, and then the image is trashed, the post thumbnail still appears since the _thumbnail_id meta key exists.
I see a couple of different ideas that might provide a solution. I'm happy to write the patch but I need some direction on the best option.
- Update get_post_image_id() in post-image-template.php to check if the image has been trashed before returning the id. This adds a little bit of extra overhead but would keep the post thumbnail in place if they restore the image. One possible downside is that if the user later restores the image from the Media page then they may be surprised that the post thumbnail has also returned.
- Delete the _thumbnail_id when the photo is trashed. This would mean that if the user clicks Undo then the photo thumbnail is no longer attached. It may be nice to delete the _thumbnail_id when a photo is deleted anyway to keep the table a little more tidy.
Any thoughts on the best approach to this?
Change History (26)
- Milestone 2.9 deleted
- Owner set to aldenta
- Status changed from new to assigned
comment:13 @caesarsgrunt — 6 years ago
- Component changed from Trash to Media
- Summary changed from Post thumbnail remains after image is trashed to Images are still visible if trashed or if their parent post is unpublished