I have a situation where I need to get all the images used in some kind of post. Now the problem is that attachments is saved only when I upload new image, if I use some other image which was already uploaded, it doesn't change my post attachment.
So even if I change all the images in post, Wordpress still see that my post attachment is that very first uploaded image, not the new one. Any ideas how should I rewrite the attachments even if image is not a new one?