Created
May 8, 2024 21:50
-
-
Save josecaos/3e1a8f503ccff89bb2d0ba898770c198 to your computer and use it in GitHub Desktop.
Change the WP database Prefix
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
| ### How to change WP Prefix | |
| - Change prefix in wp-config.php file | |
| ''' | |
| $table_prefix = 'new_prefix'; | |
| ''' | |
| - In phpmyadmin | |
| - Select the database. | |
| - Check on the ‘check all’ checkbox to select all tables. | |
| - Click on the drop-down and select ‘Replace table prefix.’ | |
| - Replace the old prefix with the new prefix.’ | |
| - Enter | |
| - Rename Prefix in Options Table | |
| - Search the wp_ prefix in the options table using this query. | |
| - SELECT * FROM `new_prefix_options` WHERE `option_name` LIKE '%previous_prefix_%' | |
| - Update Prefix in Usermeta Table | |
| - We need to search wp_ as a prefix on the usermeta table and replace it using this query. | |
| - SELECT * FROM `new_prefix_usermeta` WHERE `meta_key` LIKE '%previous_prefix_%' | |
| - After doing that, you also need to replace some values in the table wp_usermeta and wp_options using the queries below. | |
| SQL | |
| - UPDATE `new_prefix_usermeta` SET meta_key = REPLACE(meta_key, 'prev_prefix_', 'new_prefix_') WHERE meta_key LIKE 'prev_prefix_%'; | |
| - UPDATE new?prefix_options SET option_name = replace(option_name, 'prev_prefix_', 'new_prefix_') WHERE option_name LIKE 'prev_prefix_%'; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment