Before Proceeding
Before completing these steps, please consider exporting a copy of your website’s database.When might you want to do this?
- After completing a migration of a WordPress website, you might find that the image links are broken.
- You have changed a WordPress website’s domain name, and need to update the image links.
How to fix the image links
- Log in to cPanel.
- Click on PHPMyAdmin under Databases.
- To the left of the interface, click on the WordPress database you want to fix the image links for.
- Click the SQL tab.
- Input the following SQL code into the box under Run SQL query/queries on database, ensuring that you replace “yoursite.com” with your domain(s) accordingly:
UPDATE wp_posts SET post_content = replace(post_content, 'old_url', 'new_url');
- Click Go.