Recovered WordPress installation (on localhost) links broken and images not showing

The WP database stores the URL of the uploaded media item. You can see the URL when you look at the media item on the Media page.

A move of the WP install gives the new site a new URL. But the URL for the media items in the database is not always changed, depending on how you did the move.

So, you need to do a search/replace on the database, searching for the old URL and replacing it with the new URL. You can do this manually with phpMyAdmin, but there’s an easier way – as usual, ‘there’s a plugin for that’.

I use the ‘Better Search and Replace‘, which is quite easy to use. It has worked well to find all instances of the old URL and replace it with the new URL. That fixes any wrong URLs in media items (and anywhere else in the WP database). It is what I use when I move a site from one place to another for any reason.

You will need to search/replace when you move the site from your local site to it’s new hosting place. That’s another involved process, but you will probably want to use the plugin for that, as it makes URL corrections in the database much easier.