Images not working after updating the WordPress URL

April 1, 2013 by: Sudheer

You may have installed your wordpress to different URL something like and now you want to change it . You have update the Site URL and Home URL (click here for more details) and pointed the domain to the folder. Your website is working fine and you are able to access the wordpress dashboard. However, you are not able to access the images now. The image path are loading with the old path like with the 404 error. How it can be fixed?

The images are not loading because the image path is set to in all the posts. You have replace the old path with the path. You can do it using the plugin ‘Search and Replace‘.

If you do not wish to use the plugin, you can run the below MYSQL query to change the path in the posts and other tables where the path is set to old URL .

update wp_options set option_value=replace(option_value,'','') where option_value like "%";
update wp_posts SET guid=replace(guid, '','');
update wp_posts SET post_excerpt=replace(post_excerpt, '','');
update wp_posts SET post_content=replace(post_content, '','');
update wp_postmeta SET meta_value=replace(meta_value, '','');

It will replace all the fields which contains to .

Filed under: WordPress

Leave a Reply