How to fix image links after WordPress migration?

Sometimes when you migrate your WordPress website you can face problems related to image links. You need to fix this issue otherwise, your visitors will not be able to properly see the images present on your site. To fix this issue follow the steps given below:

  1. First, log in to your cPanel using your account credentials.                           
  2. Then go to DATABASES > phpMyAdmin.       

                                                                                                          
  3. Then search for the newly added database, then click on it.
                                     
  4. When you click on it a list of tables will appear. From the list of tables select wp-post.     
                                                                                                                               
               
  5. Click on the SQL tab which is present at the top bar.         
                                                  
           
  6. In the MySQL editor screen go to the code area and paste:
    UPDATE wp_posts SET post_content=(REPLACE (post_content," "," "));​

    Inside the first quotation, write the domain name of your old site and inside the second quotation mark write the domain name of your new site. For example, I have changed the site domain name from 'abc.com' to 'def.com'. Then the code will look like below:
    UPDATE wp_posts SET post_content=(REPLACE (post_content,'abc.com','def.com'));​

With this, your problem with the image link will be fixed.

Did you find this article useful?