I've got a Media Library mess on my hands. Transferred old site to staging server for redesign and uploaded large .../content/uploads via FTP after I was unsuccessful in importing media files thru the Wordpress Importer. All pages and posts imported fine. Changed all urls to the staging server domain - no problem, but lost all attachments to media in pages and posts. Used "Add from Server" plugin to try and register the uploads folder to the Media Library. It returned a lot of results, but no media re-attached. All embedded links to to media in posts and pages are broken and all Featured Images result in the monochrome beachball within the Featured Image widget within the right sidebar post editor. I've spent hours trying to sort this -- disabled all plugins, contacted Theme publisher (Divi), searched WP Forum and finally searched here for awhile. Lots of similar issues, but no joy. Finally, I thought I'd just bite the bullet and go thru all the posts manually and replace all media within posts thru Add Media function and remove and reapply all Featured Images in the sidebar thru the media search function as Featured Images cannot be selected in anything but Grid view.

What I'm looking at now -- Media Library list view shows all images, but none are attached even after replacing them manually. Media Library ALL IMAGES Grid View only shows a fraction of all the media available in List View. Media Library (Unattached) Grid View shows all images, but after manual replacing nothing moves over as added to ALL MEDIA Grid View... and again, nothing is attached anywhere.

I mean, it working on the front end, but the reason this is important to me is that once the redesign is done I'm only going to be using maybe 100 of 1000 images in the uploads folder and if I can't register or differentiate the active images from the others, there's not going to be any way to clean this site up and get it down to a reasonable size.

Man, that's a long explanation. There's a possibility this is a simple, knuckle-headed move on my part, but I've used this same process dozens of times and never had an issue after querying the DB for the domain change. Any idea what I'm doing wrong? Many thanks in advance.

Theme: Divi 4.0
Staging Domain: http://langston.combsdoadly.com
WP Version: 5.2.4
PHP Version: 7.3
Same behavior in all browsers

  • Maybe try resaving permalinks.
    – Ollie
    Oct 25, 2019 at 1:18

1 Answer 1


A media 'item' has a URL in the wp-posts database that points to the file location.

If you change domain names, you have to adjust all of the occurrences of the old domain name to the new name...including in the wp-posts database for media URLs.

A search and replace plugin (I like "Better Search and Replace", but there are other choices) will allow you to change any occurrence of www.olddomain.com to www.newdomain.com .

Backup your database first, of course.

  • Thanks, Rick. That’s what I meant when I said all URLs have been switched over to the staging server domain. I just ran the search & replace plugin and found no occurrence of the old domain. That’s what I don’t get. Whenever I’ve done in the past (I used to use a plugin called Automatic Domain Changer) everything sync’d. The thing I don’t get is selecting All Media in grid view only shows a small portion of files that show in List View. Even after manually replacing images in 75 posts, nothing shows as attached or can be newly found in the All Media grid view. GUID issue maybe? Anyone?
    – Bernie
    Oct 24, 2019 at 2:11
  • I've imported a large site (lots of pix) to a new site using the WP Importer process. And I noticed that I had to run the Importer process many (many!) times to get all of the images imported. That Importer process will time out, so you think it's done, but it's not. I've had to keep on Importing until the "already found" message repeats on the last image file that is 'already found'. Has taken hours, sometimes. Look at the post that has a missing pix file, and look at the URL in the 'text' mode. Then see if that media file exists where the href is looking. Oct 24, 2019 at 2:24
  • Rick/Ollie, I've run the importer until my arm's sore - no change. Then I thought maybe the old site export was flawed, but that doesn't seem to help. If anything, I've got too many images. They're just all in the wrong place within the media library. Then I saw Ollie's suggestion and I thought, Oh, crap... that's it! I was sure that the old site permalinks were saved in a different structure than I have set in the development site, right? No such luck. I re-saved the permalinks a couple times, but no help. I just went ahead and went thru each post manually and rebuilt. At least it works now.
    – Bernie
    Oct 26, 2019 at 13:40
  • If I could just get "all media" in list view to display in grid view, I could clean it up manually. Obviously grid view is the view you want when adding media, plus when setting Featured Images, list view is not offered as an option. (sigh)
    – Bernie
    Oct 26, 2019 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.