I would like to rename the prefix for WordPress database. I understand that the way to do this is to replace the wp_
prefix in the phpmyadmin tables.
The fields that begin with wp_ are easy to find and replace. Do I need to change fields that contain _wp_
within them? For example:
Do I need to replace the wp_ in the below?
dismissed_wp_pointers
or
_wp_attached_file_wp_pointers
.
EDIT
Notice that in addition to replacing “table” prefixes, I would also update “rows” within a table. For example, within the table wp_usermeta
I must replace a few rows such as wp_capabilities
Within wp_usermeta
table there is a row called
dismissed_wp_pointers
Am I suppose to replace the wp_ in there?
The prefix refers to TABLE names (e.g.
wp_commentmeta
), and keys that are PREFIXED within tables.This is useful for multiple blogs that share the same database.
See more about Database Table Prefixes in the Codex.
If you’re changing this prefix, you only need to update table names and keys in tables that are PREFIXED (i.e. begin with)
wp_
. These are likely in the Options and UserMeta tables.You will need to update all database tables that begin with
wp_
to use your new prefix. This prefix should be set inwp-config.php
. You will also need to update all of themeta_key
in theusermeta
table andoption_name
in theoptions
table fir values that contain your previous prefix to use the new one.Update PREFIX_options table option_name values
Update PREFIX_usermeta table meta_key values
See one of my other answers for an example of why it is important to update these values (the
$wpdb->prefix . "capabilities"
key in this case).It seems that you should not change
dismissed_update_core
‘s name.After reading doublesharp’s comment, I made a search through the WordPress’s code and found that
dismissed_update_core
was hardcoded, unlikewp_user_level
for instance. Prefixed names use$wpdb->get_blog_prefix()
(which returnsbase_prefix
for single blog WordPress sites) or$wpdb->prefix
that you can lookup in the source code.You’ll find the hardcoded
dismissed_update_core
inwp-adminincludesajax-actions.php
andwp-adminincludesclass-wp-internal-pointers.php
.