Skip to content

Instantly share code, notes, and snippets.

@THEtheChad
Created January 27, 2012 16:44
Show Gist options
  • Save THEtheChad/1689695 to your computer and use it in GitHub Desktop.
Save THEtheChad/1689695 to your computer and use it in GitHub Desktop.
SQL used to generate replace statements for all WPdb tables.
SELECT CONCAT(
'UPDATE ', table_name,
' SET ', column_name, ' = ',
'REPLACE(', column_name, ', "oldURL", "newURL");'
)
FROM information_schema.columns
WHERE table_schema = 'wordpressDBname';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment