Error with attachments and images on changing a WordPress blog’s domain

A friend had to change domain for her WP blog and after doing that all images and attachments links were broken :-(

How to fix this? As stated by an old page of My Digital Life:

If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

This SQL instruction still works in WP 2.8.6 but remeber to change the wp_ prefix :-)

This entry was posted on dicembre 14, 2009 at 4:56 and is filed under temporary supported software (Tags: , , , , , , , ). You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.

Comments are closed.