As I understand default WP behavior:
When you upload an image to a post and save it (as a draft or published post), the image becomes "attached" to the post. This can be double checked by going to Media > Library > 'Uploaded To' column.
In order to mark an image as unattached to any post, it must be done manually by deleting the post. (Is there another way?)
My main question is: Is there a way for me to tell WordPress to mark images as "unattached" if they are not inserted or linked in any existing posts?
We upload 20 (or more) images to a post and insert them. These are all automatically attached by WordPress to the post. We want this to happen, because our theme template pulls all attached images per post.
Before the post is published, it's edited and some images are taken out and won't be used again.
We're looking for a way to detect which images are not being used* in the post, and automatically unattach them from that post. This is so that we can just head into
Library > Unattached, select them all and delete them.
* I originally used the term 'unlinked' because all the inserted images are
<a href=""><img></a> so it may help in terms of detecting what are being used because a link to the image is present in the post.