WordPress.org

Ready to get started?Download WordPress

Forums

Editing the wp-settings.php to refelect certain table prefix's (4 posts)

  1. Vaughant
    Member
    Posted 1 year ago #

    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.

  2. Hristo SiteGround
    Member
    Posted 1 year ago #

    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 :)

  3. Vaughant
    Member
    Posted 1 year ago #

    Thanks Hristo SiteGround for your reply!

    Wont that change the table prefix for the entire installation?

    Or for specifically the users and usermeta?

    :)

  4. Hristo SiteGround
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic