Images Not Showing Up After Migration

Table of Contents

If your images are not showing up after a migration, or are being loaded from the wrong url, its most likely because they still have the old url in the database.

You can replace this in two ways.

Plugin #

You can use the “Better Search and Replace” plugin to fix broken images. Search for the old domain (ie, “site.domain.com”) and then replace all occurrences with the new domain (ie, “domain.com”). We strongly recommend making a backup first before doing this.

phpMyAdmin #

From the panel, open up the “phpMyAdmin” option. Select the database where your WordPress site is stored and go to the “SQL” tab.

Enter the following line:

UPDATE wp_posts SET post_content=(REPLACE (post_content, '<old url>','<new url>'));

Replace “<old url>” with your old site url, or where the images are being loaded from. Replace “<new url>” with the url you want your new site to be on. For example, if my old site was “site.domain.com” and I want to move it to domain.com, I would do the following.

UPDATE wp_posts SET post_content=(REPLACE (post_content, 'site.domain.com','domain.com'));