How to search and replace text in all posts of a wordpress.com blog (NOT wordpress.org one)?

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!)

Related posts

Leave a Reply

2 comments

  1. 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.

  2. 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.