Skip to content

Instantly share code, notes, and snippets.

@MacConin
Last active August 29, 2015 14:16
Show Gist options
  • Save MacConin/4709f14953a35818704f to your computer and use it in GitHub Desktop.
Save MacConin/4709f14953a35818704f to your computer and use it in GitHub Desktop.
Search & Replace in modx_site_content
## searches for 'old'
## and replaces it with 'new'
## in field 'content'
## restricted to context 'web' (which is optionally)
## always make a backup
## there is NO undo !
## optionally
## check if there is a match:
##
## SELECT content
## FROM modx_site_content
## WHERE content like '%old%';
UPDATE modx_site_content
SET content = REPLACE(content, 'old', 'new')
WHERE content LIKE '%old%'
AND context_key="web";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment