WordPress Database Prefix Changer Tool

Time is the most valuable resource today. My pleasure is to create a tool that can save time. More info about how and why do you need to change WP database prefix read here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
RENAME TABLE wp_comments TO new_comments;
RENAME TABLE wp_commentmeta TO new_commentmeta;
RENAME TABLE wp_links TO new_links;
RENAME TABLE wp_options TO new_options;
RENAME TABLE wp_postmeta TO new_postmeta;
RENAME TABLE wp_posts TO new_posts;
RENAME TABLE wp_terms TO new_terms;
RENAME TABLE wp_termmeta TO new_termmeta;
RENAME TABLE wp_term_relationships TO new_term_relationships;
RENAME TABLE wp_term_taxonomy TO new_term_taxonomy;
RENAME TABLE wp_usermeta TO new_usermeta;
RENAME TABLE wp_users TO new_users;
UPDATE new_options SET option_name = REPLACE(option_name, 'wp_', 'new_') WHERE option_name LIKE 'wp_%';
UPDATE new_usermeta SET meta_key = REPLACE(meta_key, 'wp_', 'new_') WHERE meta_key LIKE 'wp_%';

And do not forget to make changes in wp-config.php $table_prefix = 'new_';.