• I tried searching for this but I can’t find anything because I’m most likely phrasing it wrong.

    I have two different WP installs but I need them to share the same database/dataset. I need the two installs to share the same post and user data.

    I did this a few years ago but I can’t remember for the life of me how to do it again or where to find the Howto.

    If someone could point me in the right direction that would be great.

Viewing 6 replies - 1 through 6 (of 6 total)
  • In your wp-config file just set the database connection details to be the same.

    Thread Starter booblla

    (@booblla)

    Both sites are using the same DB, I just want the second install to read/share selected tables in the DB.

    I found exactly what I want to do, but it doesn’t appear to apply to WP v3.

    Original post: https://www.ads-software.com/support/topic/two-sites-two-themes-one-database-same-content?replies=19

    I’ve done this before, having 6 websites shoot out content from the same database.

    It’s easy enough to do. Upload WP into both directories. Make sure they have the identical wp-config.php file.

    In the second sites directory do the following:
    In the wp-settings.php file change the options database value to something like this:

    // Table names
    $wpdb->posts = $table_prefix . ‘posts’;
    $wpdb->users = $table_prefix . ‘users’;
    $wpdb->categories = $table_prefix . ‘categories’;
    $wpdb->post2cat = $table_prefix . ‘post2cat’;
    $wpdb->comments = $table_prefix . ‘comments’;
    $wpdb->links = $table_prefix . ‘links’;
    $wpdb->linkcategories = $table_prefix . ‘linkcategories’;
    $wpdb->options = ‘YOURNEWPREFIX_options’;
    $wpdb->postmeta = $table_prefix . ‘postmeta’;
    $wpdb->usermeta = $table_prefix . ‘usermeta’;

    $wpdb->prefix = $table_prefix;

    See how I’ve removed $table_prefix . in the options line?
    Instead of YOURNEWPREFIX put something like ‘site2’ or whatever you want.

    Then, in PHPmyAdmin duplicate the wp_options table, and rename one of the them to be YOURNEWPREFIX_options, so if you chose ‘site2’, it would be ‘site2_options’.

    Bingo. Edit the information in the ‘site2_options’ table to refelct the correct information for your second site and you will be on your way.

    Anyone have any idea how to do this in WP v3?

    There is no //Table names in wordpress v3 wp-settings.php file… does anyone know how we can do this now?

    Thanks!!

    WordPress multisite would be the closest I can think. Have a look at it here.
    Also as you already have installed wordpress this article may be useful too.

    Hope that helps
    Aventura

    Will multisite help, as I want the content to be mostly the same on each?

    I couldn’t really tell you as personally, I have never tried it. Best thing to do would be to test it on localhost and see if you can post to two sites at once with same data I guess.

    I suggested it because it integrates multiple wordpress “installs” so is most likely way to easily achieve what you are looking for.

    Aventura

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Two Different Installs Same Data’ is closed to new replies.