• Is there a plugin that would allow you to share certain tables in a database in order to have the same posts on each installation via different domains.

    Example i would like to run 2 wordpress blogs with the same content but with different layouts, and different plugins. I would need to share the posts but would need to keep 2 separate databases for the blogs internal settings like themes, and comments.

Viewing 4 replies - 1 through 4 (of 4 total)
  • This thread should be helpful; it’s not a plugin but some code to work with.

    Thread Starter yarray

    (@yarray)

    found the solution here

    QUOTED FROM https://www.ads-software.com/support/topic/312547?replies=2

    Nevermind, I think I found it thanks top this site :
    https://www.wiseontech.com/hack/wordpress-hacking-multiple-blogs-on-one-set-of-tables-2

    Down in the comments they refer to more modern installs. I did this:

    Edit the wp-db.php file in the wp-includes directory.
    In the function set_prefix($prefix) section

    After :

    foreach ( $this->tables as $table )
    $this->$table = $this->prefix . $table;

    Added :
    $this->options = ‘wp_’ . ‘options’;

    Or whatever your new prefix is. Testing now, I’ll write again if I experience any issues. This is a case of spending 4 hours a few nights ago, and going around in circles. Then after only 20 minutes of trying tonight, getting it working. The benefits of rest apparently.

    Here is the rest of the code you would need in addition to the ‘options’ for all of the tables in wordpress.

    $this->posts = 'wp_' . 'posts';
    $this->categories = 'wp_' . 'categories';
    $this->options = 'wp2_' . 'options';
    $this->links = 'wp2_' . 'links';
    $this->postmeta = 'wp_' . 'postmeta';
    $this->terms = 'wp_' . 'terms';
    $this->term_taxonomy = 'wp_' . 'term_taxonomy';
    $this->term_relationships = 'wp_' . 'term_relationships';

    Looks interesting. You original question was sharing a DB across different domains rather than a multiple WP install on one domain and DB. Hope that works for it; post back your results for others to read.

    Thread Starter yarray

    (@yarray)

    yea that code is for sharing a DB across different domains

    it shares everything except the
    options links users and usermeta tables

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Share certain tables of a WP database over 2 domains’ is closed to new replies.