Fixing Image Links After a WordPress Migration Updated on June 21, 2023 by Scott Mitchell 1 Minutes, 56 Seconds to Read As we continue our tutorial series on migrating your WordPress site to InMotion Hosting, the next thing we want to cover is how to update the URLs for images within your pages and posts. They are coded differently so simply changing the site URL will not fix this. In this tutorial we show you 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. A couple of benefits of being an InMotion WordPress Hosting customer is that we can migrate over your existing website or easily get you set up with a site that has WordPress already installed. How to Fix Your Image Links After a WordPress Migration Log into your cPanel interface. Once inside the cPanel, find the Databases category and click on the phpMyAdmin tool icon. You are now on the main phpMyAdmin page. Find the newly added database and click on its name from the left-hand sidebar. Our sample database is named testdb. This opens the database and the screen refreshes with a list of the tables. Using the sidebar again, find and click on the wp-posts table. Look to the top of the screen and you will see several tabs that run across the page. Click on the SQL tab. You are now on a MySQL editor screen. In the code area, copy the following bit of MySQL. UPDATE wp_posts SET post_content=(REPLACE (post_content, '','')); Be sure to replace with the old sitename and with the new site name. For instance, our original site was inmotiontesting.com and the new test site will be at test.inmotiontesting.com so the code should appear as below: UPDATE wp_posts SET post_content=(REPLACE (post_content, 'inmotiontesting.com','test.inmotiontesting.com')); Click on the Go button to run the code and change 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. Below are before and after shots of the changes made. Note that the image paths are displayed in the lower left hand corners of the images. You can see how they switched to the new sitename after the SQL code ran. Before After Share this Article Related Articles How to Create and Edit Pages and Posts in WordPress What is the Difference Between Pages and Posts in WordPress How to Add Videos to WordPress How to Create and Add a Logo To WordPress How to Use a Custom Paypal Button in Your Website How to Track WordPress Vulnerabilities With WPScan How to Redirect WordPress Posts After Changing Permalinks W3 Total Cache – Guide to WordPress Caching How to Globally Change the Font in WordPress Create a Footer for WordPress