Thursday, July 15, 2021

change table prefix of wordpress site

 Change table prefix of WordPress site

 

By default WordPress table prefix is starting with wp_ , and we recommend, it should be different on every WordPress domain,
if you are installing new WordPress, then its easy to type the specific prefix at the time of installation,
but if anyone wanna change the prefix of old prefix site, then follow these steps:-

    Step 1 - Change the table prefix in wp-config.php
    Step 2 - Change the table prefix in the database
    Step 3 - Replace all references to the old prefix


Step 1 - Change the table prefix in wp-config.php

open file wp-config.php using any editor, and locate the table_prefix

change it. like

    $table_prefix = 'wp_';

    $table_prefix = 'newPrifix_';

Step 2 - Change the table prefix in the database

open database using phpmyadmin, click on the database,

select all tables (click check all) and select Replace table prefix then submit it



 





 

 

and


Step 3 - Replace all references to the old prefix

       using phpmyadmin, click on SQL , and paste these commands in this window, 

just replace old_prefix and New_Prefix in this content:

update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_capabilities' where meta_key = 'OLDPREFIX_capabilities';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_user_level' where meta_key = 'OLDPREFIX_user_level';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_autosave_draft_ids' where meta_key = 'OLDPREFIX_autosave_draft_ids';
update NEWPREFIX_options set option_name = 'NEWPREFIX_user_roles' where option_name = 'OLDPREFIX_user_roles';

 


 

and click on Go button,

 

That's it!!!

 

 

0 comments: