Multi Quick Edit – Possible Or Impossible?

I’m not sure if there’s a WordPress-specific way to do this, but you can do a quick find-and-replace for the offending terms.

I don’t know if it follows a pattern, but if you have access to the site through SSH you could do a MySQL dump and find/replace/reimport easily.

Try this:

mysqldump -uDBUSER -p DBNAME > mysql.dump
vim mysql.dump
:%s/SEARCHTERM/REPLACEMENT/g
:x
mysql -uDBUSER -p
DROP DATABASE DBNAME; CREATE DATABASE DBNAME; USE DBNAME; SOURCE mysql.dump;
QUIT

That will, in order:

  1. Create a backup of your database named mysql.dump
  2. Open the new database backup in Vim
  3. Do a find-and-replace for the whole database
  4. Save and close the modified file
  5. Log into MySQL
  6. Delete the current table, create a new one with the same name, select it, and load it with the modified data
  7. Exit MySQL

It would probably be wise to create a second backup that isn’t modified just in case something goes wrong.

Also, make sure you swap out the placeholder values for database credentials, as well as your SEARCHTERM and REPLACEMENT values.

You could do all of the steps above with other tools as well (such as phpMyAdmin and a text editor); it’s just a bit quicker if you can slam through it all in a terminal window. (This is especially useful if the database is too big to upload in one piece through phpMyAdmin.)

UPDATE:

There’s an even easier way to do this that I’ve started using. You can actually do the find-and-replace as part of the mysqldump command:

mysqldump -uDBUSER -p DBNAME | sed -e 's/SEARCHTERM/REPLACEMENT/g' > db_dump.sql
mysql -uDBUSER -p
DROP DATABASE DBNAME; CREATE DATABASE DBNAME; USE DBNAME; SOURCE mysql.dump;
QUIT