I noticed that all my images on the posts here weren’t showing and it was because the url to their location was still pointing at the sub blog on The Comluv Network so I needed a way to edit the database to update the url to point to the files held here.

Easy with a REPLACE function on the wp_posts table.

You just need 3 things for the replace command :

  1. The row you’re altering
  2. The string you’re searching for
  3. The string you’re replacing with

UPDATE `wp_posts` SET `post_content` = REPLACE( `post_content` , "fiddyp.comluv.com/files/", "fiddyp.co.uk/wp-content/uploads/" )

It did the whole table of posts in less than a second. Sweet, now all my images are back to normal on this site.