I have nearly completed a project but forgot in the first place to change the wp_ db prefix on install. Now i am a little bit worried to change it afterwards in fear of breaking the whole installation. Therefor the question if these described methods still work with 3.8.x or has anything change since then?
http://digwp.com/2010/10/change-database-prefix/
and have only table and field names to be changed? cuz i also saw a few prefixes starting with wp instead of wp_ ? Best regards Ralf
The basic idea should work– change the prefix in both
wp-config.php
and in the database itself. What isn’t covered would be cases where the prefix is used in other contexts such as when used as part of a “meta” key. Those cases you would need to trace down one by one.You could also have trouble it the prefix has been hard-coded into anything, but hopefully that isn’t the case.
The safe thing to do, if you are able would be to copy the entire database to a database with a different name, and alter the second database. Switching between the two would be a simple edit of the database name in
wp-config.php
and you would have nearly no chance of data loss if you make a mistake, just make sure no one is editing the site while you play with it.I’d download a complete backup of the site to disk, just to be 100% safe.
Supplementary to s_ha_dum’s answer and the comments:
The meta keys I needed to change when I did this (v4.8.5) – i.e. all wp_usermeta.meta_key entries beginning wp_, or whatever your current prefix is – were:
Symptoms: visiting /wp-admin/users.php and seeing nothing in the ‘Role’ column (also blank role when running WP-CLI’s
wp user get
), and having an empty ‘Change Role To’ dropdown at the top & bottom of the list.It’s fixable with a simple find and replace, e.g.
(–dry-run means it’ll tell you how many rows would change but not actually do it yet. You can narrow it to, or skip specific tables if you like too, see the documentation.)