Now that I’ve moved all my blogging onto the WordPress platform, I have to begrudgingly admit to it being pretty damn cool after all. However, there are a few quirks and missing bits of functionality that I find bemusing and this seems to be one of them:
There doesn’t seem to be an easy way for searching for and replacing with specific bits of text across all your posts.
Surely this is an essential feature to have don’t you think? Now I haven’t come across a plugin that does this efficiently yet either, so I’ll just point you in the direction of doing it yourself using some plain old SQL, naturally assuming that you have access to your database with some sort of tool like phpMyAdmin for example.
The SQL statement you need to run looks like this:
update wp_posts set post_content = REPLACE(post_content, "X", "Y");
where wp_posts is the name of the table that holds all of your posts (this is the default name), X is what your want to replace and Y is what you want to replace X with.
And that’s it. Modify the SQL statement to look how you’d like and then run it, simple as that! :)
Note: As always, use with caution and at your own risk – always backup your posts table first!