WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm familiar with this method...

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);

The problem is, I'm trying to do this to all tables (or select tables), but need the replace to hit all columns for the table in question. Currently, the only way I've found for a table with 20 columns is to repeat this query 20 times. Once for each column.

Is there any way to simply apply the search replace on the table rather than column?

share|improve this question
stackoverflow.com/questions/421227/… – Milo May 25 '11 at 18:51
up vote 0 down vote accepted

Have you tried the search and replace plugin? it will allow you to select particular tables: http://wordpress.org/extend/plugins/search-and-replace/

Of course use it with caution. etc.

share|improve this answer
Well, there's legacy tables from an older corporate database. So in short, this data doesn't necessarily live in only wp_***** tables. That's why I was looking for a way to do it with a query. – Will Ashworth May 25 '11 at 18:48
ah sorry. then your question maybe better suited in superuser.com or even better Database administrators: dba.stackexchange.com – chrisjlee May 25 '11 at 18:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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