Fix Broken Image Links in WordPress Post Migration: A Complete Guide

Fix Broken Image Links in WordPress Post Migration: A Complete Guide

There are a few problems that can emerge after a website migration. So when you switch hosting providers or simply move to another location, you should be prepared to fix whatever comes along the way. One of those problems is the broken images.

There are two ways of looking at this problem. If you have changed domain name, then you’d have to update the URL for all the posts where you find broken images. But if you haven’t changed the domain and simply switched hosting providers, you need to change website address from your admin panel.

In most cases, tweaking and updating the URL solves this error. In this article, we demonstrate how to do so on your own.

Step-by-step Solution

To fix this, you need to work with SQL queries and make changes to the MySQL table. Here are the steps to follow:

Log in to your cPanel account

Open phpMyAdmin that can be found under the Databases section

On the left hand side, select the name of the database. In case you don’t know the name, head over to the database wizard. It contains all the databases powering your website

Once you’re inside the database, you’ll see the tables present in it. Every table starts with the “wp_” prefix. If it’s something else, then nothing to worry. WordPress may have altered it for safety reasons

Open the “wp_posts” table

Now, from the top nav bar, click on “SQL”. It will open up a box where you can add your query

You need to add the following codes in the box:

UPDATE wp_posts SET post_content=(REPLACE (post_content, '',''));

The above code clarifies that the current post links have been changed to the new URL. In the above case, is the old domain and is the new one (which is actually a subdomain).

Now hit the “GO” button to run this code. Now reload your website and the image links should work just fine.

So that’s how you fix this error. If problem persist, contact the support team for assistance.
First release
Last update
0.00 star(s) 0 ratings

More resources from kumkumsharma