Two WordPresses and One Database

Hello good people,

Can I wire up a WordPress to an existing database on a completely different WordPress?


Can I use different themes, plugins and pages on this second WordPress?


I want to keep the existing logins, posts, media, etc from WordPress #1 and test the themes, plugins and pages on WordPress #2 without damaging the WordPress # 1 database.

WordPress #1 is the current live site.

WordPress #2 is the new version of the site in development.

I know there are several ways of doing this, but this is the approach I prefer to go with–if it will work.

Thank you in advance,



  • Arnold
    • El Macho WP

    Yes you can. You need a separate directory for the second site. The trick is to change the DB prefix from “wp_” to something else when you create the tables for the second WP. This controlled by

    $table_prefix  = 'wp_';

    In the wp-config.php file. They will be total separate except forsharing the same DB

  • Griphon Marketing
    • Flash Drive

    Yes, this can be done. Install a fresh wordpress with its own prefix, in the same database. Then, use the following line in your wp-config.php:

    define(‘CUSTOM_USER_TABLE’, ‘wp_users’:wink:;

    To make the new install use tables from your current site. That way you only use the information you want, and don’t have to connect tables that contain information you don’t want changed. And this way, any new tables etc… will only be added to the new wordpress, and won’t effect your current live site at all.

  • anotheropus
    • The Incredible Code Injector

    Hey good people,

    This seems to be good advice if one WordPress is installed and the second one is not yet installed.

    I have two WordPress installs already.

    I’m trying to see if there’s a way to connect the second WP to the db of the first WP without jacking up the site, content or anything on WP1.

    Do you guys know if this is possible?

    Thank you,


  • PC
    • WPMU DEV Initiate

    Hey Chris,

    I was just checking through some of the old thread to make sure that we did not miss anything.

    Did the advise by get you sorted ? or are you still looking for support on this thread ? Please advise.



    Sales &Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.