Attach unattached images in WordPress automatically after migration

Most of the time, after every WP migration, specially if you’re migrating from to a self-hosted WordPress blog, your images inside your media library will automatically become unattached. You can fix this manually by editing each and every image in your media library and attaching it to the specific post where it was attached before migration.

But is there a faster and quicker way to attach all unattached files automatically? Of course there is. I’ve been searching for it since I’ve migrated one of my friend’s site to a self-hosted WP blog from and I found this very useful thread in the WP support forums.

Anyway, to make this post short, there’s a nifty plugin that was shared by oomskaap. I downloaded and tested the plugin and it actually works. If you also want to automatically attach unattached images in your WP blog, just download this plugin. (I uploaded it in my blog in case the plugin that was uploaded in disappears.)

And oh, you can fork it in Github if you want.


4 responses to “Attach unattached images in WordPress automatically after migration”

  1. This is excellent bu has 1 flaw. It does not attach the featured image to the post. It attaches all unattached images present on the content, since the featured image is not present (my theme displays it on top automatically) it gets ignored and therefore unattached. Nevertheless pretty good plugin.

  2. The plugin is good, but my server seems halt when I run it. There many posts on my blog but the images are not getting attached. Tried it several times. IS there any active dev. on this plugin?

    1. Bryan Veloso Avatar
      Bryan Veloso

      not sure. you can check the plugin page at for this specific plugin. 🙂

  3. Really great post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.