I have some texts that need to be replaced in every posts in my blog. Is it possible to do that?

ps (I need to tag this question as search-and-replace but not enough reputation to do that. Please add the tag if you can. Thank you!)

2 Answers 2


You have at least three different ways:

1) Edit directly in the database. The content of the post is stored in post_content column of wp_posts table. Since you are running your own WordPress, you should have full access to that. Just use SQL to do search and replace. Remember, the table content is sort-of HTML, so may have tags and/or escaped characters

2) Export your blog into XML, do search/replace in any UNICODE ready editor and import it back in after deleting original content. I would practice this a couple of times first though, especially checking what happens with images, etc.

3) Use WordPress remote access API to iterate through posts and update them that way. Good for programmers and/or more flexible way of doing things, such as content-specific updates.

  • In the title is specified that this is on WordPress.com, not a self-hosted blog, so your first suggestion won't work here. The XML-RPC way is interesting!
    – Jan Fabry
    Commented Jan 4, 2011 at 16:40
  • @Rafalovitch Your #2 suggestion: Deleting the original posts will make my blog lose the original created date of the post and I don't think I want to do that.
    – Nam G VU
    Commented Jan 5, 2011 at 3:58
  • @Rafalovitch I'm a developer and love to try your #3 solution. Thank you!
    – Nam G VU
    Commented Jan 5, 2011 at 3:59
  • @nam-gi-vu, I think if you export and import WordPress-specific XML format you can preserve the dates. It's been a while since I tested though. And of course, option 3 is more fun. Commented Jan 5, 2011 at 20:43

Hi @Nam Gi VU:

I'm pretty sure that's not possible directly.

What you could do would be to export all posts to a text file, use a search and replace in a text editor and then import them back in deleting all the posts before you reimport them. Be careful to change a copy of the export in case your search and replace corrupts the file and makes it fail to import.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.