Created
November 8, 2024 17:18
-
-
Save Braunson/e38998ae880619e95fb68a5bba51d914 to your computer and use it in GitHub Desktop.
Changing the prefix of tables on a existing WordPress site
This file contains hidden or 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
-- So you have an existing WP website with a prefix you need to change | |
-- We will need to do more than just updating the wp-config.php prefix. | |
-- There are row data that reference table names we'll need to update | |
-- Assuming we're already using the wp_ prefix and for example want to | |
-- change to xyzwp_ we'll need to update the data within the tables | |
-- Update user meta references | |
UPDATE wp__usermeta | |
SET meta_key = REPLACE(meta_key, 'wp_', 'xyzwp_') | |
WHERE meta_key LIKE 'wp_%'; | |
-- Update options | |
UPDATE wp__options | |
SET option_name = REPLACE(option_name, 'wp_', 'xyzwp_') | |
WHERE option_name LIKE 'wp_%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment