Sometimes after migrating your wordpress website, some images appear broken or not displaying correctly, hence we want to cover in this post one way to update the URLs for images within your pages and posts. sometimes simply changing the site URL will not fix this so In this tutorial we will cover how to fix image links by using your phpMyAdmin tool.

IMPORTANT! This step is not mandatory. It is only necessary if your domain name is changing during the migration.

  1. Login to your Cpanel.
  2. Once inside the cPanel, find and click on the phpMyAdmin tool icon.
  3. Once on the main phpMyAdmin page. Find the newly added database and click on its name from the left-hand sidebar.
  4. This expands the database and shows a list of the tables. Using the sidebar again, find and click on the wp-posts table.
  5. Click on the SQL tab at the top of the screen.
  6. On the MySQL editor screen. In the code area, copy the following bit of MySQL.
UPDATE wp_posts SET post_content=(REPLACE (post_content, ”,”));

Do not forget to replace your old domain name with the new one. As shown below,

UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘youroldsite.com’,’yournewsite.com’));

Click on the Go button to run the code and make changes to the URLs for all images in the posts. This will also affect any other ‘hard coded’ links that were in the posts that pointed to the original site.

Next
Undefined Function Wp_is_mobile() WordPress Error {Solved}