WordPress.org

Support

Support » Plugins and Hacks » Hacks » Editing the wp-settings.php to refelect certain table prefix's

Editing the wp-settings.php to refelect certain table prefix's

  • Hi there

    If I wanted to have a multisite running off 1 database, but the sites to have there own content. I would have to run the sites with there own table prefix’s, but since the user base will remain the same that table prefix throughout the sites.

    Where do I change the table prefix for users and usermeta in wordpress? but keep the table prefix the same for the content?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    The file you need to config is wp-config.php and it should be in the root folder of your WordPress website. In it locate:

    $table_prefix = 'wp_';

    and replace that line with:

    $table_prefix = 'wp2_';

    or similar prefix 🙂

    Thanks Hristo SiteGround for your reply!

    Wont that change the table prefix for the entire installation?

    Or for specifically the users and usermeta?

    🙂

    Yes, that would require to have multiple WordPress instances on the same database. If you want to use WordPress multi user you can use this:

    Install your primary blog as normal, and set your CUSTOM_USER keys in your wp-config:

    define('CUSTOM_USER_TABLE', 'wp_users');
    define('CUSTOM_USER_META_TABLE', 'wp_usermeta');

    Create the wp-config.php for your second blog, using the same DB Connection information.
    You also need to set AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY, and the CUSTOM_USER keys to the same value as the first. You will also need to set $table_prefix to a unique value.

    Install the second blog and instead of getting a random password for the admin user, it should tell you that it found the user and is using that password.

    Repeat steps 2 and 3 until all blogs are successfully installed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Editing the wp-settings.php to refelect certain table prefix's’ is closed to new replies.