I want to change the theme on my WordPress blog to a responsive design one. At the moment however I have used some recurring html at the top of every blog post (300+ posts) which I need to change on every post for the responsive design theme to display correctly. I can do this manually but it will be very time consuming.

Does anyone know of a method where I can batch replace/remove text from a WordPress blog? Perhaps a WordPress plug-in or something?

  • 1
    You can write a SQL query to do a search and replace
    – John Conde
    Feb 16, 2015 at 16:09

2 Answers 2


I've always used Search and Replace plugin, which can do a search and replace on post content. It doesn't look like that has been tested with the latest version of Wordpress though, so another option would be Better Search and Replace which is a more recent plugin and also supports serialisation.

You can do a "dry run" before actually running it for real but do make a back up before hand!

My advice would be to remove the content completely from the posts, and incorporate it into the theme post template instead to be more flexible in the future.


WP-CLI is a good option depending on what you want to edit.

I think your best bet is going to be going into the database and doing your search and replace there.

  • I am not sure that suggesting editing the database directly is a very good idea :P What could possibly go wrong?
    – Steve
    Aug 27, 2019 at 7:44
  • Sorry if I assumed you were experienced enough to run a backup first. It would just as well on a localhost and push the changes to the database. Search and Replace does very similar function, but I've seen a lot of mistakes made using it. Without more information about what specifically is getting bulk edited it's difficult to give specific advice.
    – keepkalm
    Aug 27, 2019 at 20:47

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.