Fixing image paths in Wordpress after moving hosts

Just a quick post to let people know that moving hosts had screwed up all the image paths in my Photography section, a simple MySQL Query fixed the problem. Incase anyone else has this problem I used the following Query:

UPDATE `wp_postmeta` SET meta_value = replace(meta_value,”/mounted-storage/home58b/sub007/sc37059-NMKM/anthonyshapley.co.uk/”,”") WHERE `meta_key` = ‘_wp_attached_file’

It merely finds and replaces text where files have been attached. Run it through phpMyAdmin or whatever you use for a quick fix. Obvisously change the path to reflect your website!

Cheers and special thanks to Alex Morrision for bringing this to my attention.

If your interested in wordpress and SEO check out this UK SEO video.

Published in PHP

Leave a Comment

No Comments Yet!

Search

"Not everything that can be counted counts, and not everything that counts can be counted."