How to fix Uploaded to this post option to see group of images uploaded to a post?

First thing to try is to export and import the whole content inside of one single xml file. Maybe this does the trick. If there are no reasons for seperating the posts and the media, you should try to not do this. It can be an issue.

If this isn’t working too, you can maybe use a plugin (i.e. “All-in-One WP Migration”) to make things work. Never had any issues using this one. It is made for the migration of whole wordpress websites.


You can also try to get the images attached to the posts again.

The documentation of wordpress says: “If it is uploaded via the Media Add New Screen or Media Library Screen it will be unattached, but may become attached to a post when it is inserted into post.”
https://wordpress.org/support/article/media-library-screen/

You should try saving all of your posts again. If there are the images inserted, they might get attached to the posts in the moment they get saved.

If this does not work, you can also try to set the images by hand. In the media library you can filter the posts by “unattached”. You get all your unattached files listed and can attach them by simple clicking the “attach” link and selecting the post you like. This only is recommended if you do not have hundreds of images… Have a look: https://wordpress.org/support/article/media-library-screen/#actions