How to Fix Image Link URL After WordPress Migration – Migrating a site like WordPress from an old domain to a new domain is really annoying, because many things are sacrificed, such as backlinks and broken links. If you’re a WordPress user now you have a site that already has lots of posts and images on it and you want to do that WordPress migration from old hosting to hosting new and change to a new domain name too, of course there will be many image links on your site that don’t work, making images unable to be displayed because the image URL source has changed.
Changing image URLs manually and individually can be stressful, time consuming and tired. However, you don’t need to worry because in this tutorial I will show you how to fix the URL or replace the domain URL in your old image with a new domain URL via phpMyAdmin.
URGENT! Note that this step is optional. This is only required if your domain name changed during migration. If you are just migrating your hosting without changing your domain name, then you don’t need to do this guide.
How to Fix Image link After Migration
1. Enter your cPanel hosting page.
2. Find the menu category “Database” and click on the phpMyAdmin tool icon.
3. Select a new database on the phpMyAdmin page. Locate the database you just added and click on the name of your database in the left sidebar. Suppose a named database testdb.
4. Find the named table wp-posts and click the table.
5. Click the SQL button in the top menu.
You will now be prompted with the MySQL editor screen. In the code area, copy the following:
UPDATE wp_posts SET post_content = (REPLACE (post_content, '', ''));
Make sure to fill in your old domain name in the initial quotes and fill in the new domain name between the second quotes. For example, my original site is verandalounge.co.uk and my new site has changed to test.verandalounge.co.uk so that the code will appear like below:
UPDATE wp_posts SET post_content = (REPLACE (post_content, 'verandalounge.co.uk', 'test.verandalounge.co.uk'));
After you make changes like the code above, please click the Go button. And now your image URL will automatically change to follow your new domain name and the image can now be displayed again in your posts.
And that’s an easy way to change or repair Image URLs after you migrate your website from old hosting to new hosting by changing domains. Hopefully the above article helps you solve the problem with image URLs that don’t appear because the URL source has changed. Good luck. 🙂