Last active
December 2, 2020 16:39
-
-
Save CatEntangler/5911d7382dc645f652ed to your computer and use it in GitHub Desktop.
Anonymize wordpress user email addresses for cloning purposes. Exclude specific domain names to keep admin/selected users intact. Prefix so that addresses are still unique.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @domains='domain1.com|domain2.com'; | |
UPDATE wp_users prod_users, | |
( select ID FROM wp_users WHERE user_email NOT REGEXP @domains) clone_users | |
SET prod_users.user_email = CONCAT('DC_', prod_users.ID, '@example.org') | |
WHERE prod_users.user_email NOT REGEXP @domains; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment