Shin

SQL to change your WordPress links

A simple quickie in case I ever forget, and you might like it too.
Say you have static content, like a folder of pictures, you want to move or rename. But all your posts link to the old folder.
Here’s a quick way to update all your posts in sql, for example using phpMyAdmin:
update wp_posts set post_content = replace(post_content, '\/anime\/pics', '\/anime2\/pics');
In my case this replaces all the links containing ‘/anime/pics’ with ‘/anime2/pics’ as that’s what I renamed the anime folder to.
Note the \/ in the sql statement, you need to escape all your / slashes in the statement by putting a \ before it, or your get errors.

Work in progress... not home!
Trying to get all/most of the new code working before I start on the eyecandy.