Fix image links in your WordPress website
Warning: If you’re uncomfortable completing these steps, please have a professional web developer complete them for you. If these steps are completed incorrectly, it may cause significant issues that may be difficult to resolve.
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, ''yoursite.com, blog.yoursite.com''));
- Click Go.
Didn’t work for your site?
If the process didn’t work for you or has caused problems, you may consider trying any of the following: