After moving a site to new hosting, not all images are showing in media library

The issue is that images URLs are stored in the database as a full URL; domain and all.

When you move a site to a new URL, that doesn’t update the URLs in the database. So a ‘search and replace’ process is needed to go through the database and replace your www.olddomain.com with your www.newdomain.com .

I usually use the “Better Search and Replace” plugin to do that. It works well (and easy and fast) to take care of the problem. You could also do it manually with MySQL commands, but a plugin is much faster.

A backup of your database before is always a good idea.

Added

You can verify in the generated page code source, or with Developer Tools (usually F12, then look at the Network tab and reload the page; see the URLs that are being requested for the images).

If the images are still ‘scr’ from the old domain, then that’s how the URL is stored in the database. So the Search/Replace is needed.

Look at an existing Media item; you’ll see that one of the fields (meta values) is the full URL of the media item. That comes from the database, so a Search/Replace will fix that.

It’s possible that it is a caching issue on the phone or device. Restarting the device ought to fix that. But you can tell via Developer Tools, Network (or the page source) the URL being specified for the media item.