Archive

Posts Tagged ‘Wordpress’

Moving WordPress to another directory

March 12th, 2009 No comments

Yesterday I had to move WordPress directory for a client (don’t ask why). After following basic instructions outlined in Codex Moving WordPress page I had only one problem left – missing images in blog posts. In database they are saved using full path and were pointing to the old directory.

I came up with following query to fix the problem:

UPDATE wp_posts 
SET guid = replace(guid, 'http://website.com/dir1/', 'http://website.com/dir2/')
WHERE post_type = 'attachment'

It looks in your wp_posts table and and replaces paths to uploaded files, in this case case – from “http://website.com/dir1/” to “http://website.com/dir2/”.

Use at your own risk!

Tags: ,