Title: 2 WP Installtion sharing Posts
Last modified: August 24, 2016

---

# 2 WP Installtion sharing Posts

 *  [MrWhy](https://wordpress.org/support/users/mrwhy/)
 * (@mrwhy)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/2-wp-installtion-sharing-posts/)
 * Hi,
 * I’m trying to set up hyperdb with two WordPress Installations. I want to use 
   all functions related to posts. I want to query a certain kind of post from installation
   a within installation b.
 * I set up both installations in the global dataset. I thought that should do the
   work. But it don’t. This is my config so far.
 *     ```
       $wpdb->add_database(array(
       	'host'     => DB_HOST,     // If port is other than 3306, use host:port.
       	'user'     => DB_USER,
       	'password' => DB_PASSWORD,
       	'name'     => DB_NAME,
       ));
   
       $wpdb->add_database(array(
       	'host'     => DB_HOST,     // If port is other than 3306, use host:port.
       	'user'     => DB_USER,
       	'password' => DB_PASSWORD,
       	'name'     => "db_c",
       	'write'    => 0,
       	'read'     => 1,
       	'dataset'  => 'werb',
       	'timeout'  => 0.2,
       ));
   
       $wpdb->add_table('werb', 'wp_postmeta');
       $wpdb->add_table('werb', 'wp_posts');
       $wpdb->add_table('werb', 'wp_terms');
       $wpdb->add_table('werb', 'wp_term_relationships');
       $wpdb->add_table('werb', 'wp_term_taxonomy');
       $wpdb->add_table('werb', 'wp_usermeta');
       $wpdb->add_table('werb', 'wp_users');
   
       function wpdb_connection_error( $host, $port, $op, $tbl, $ds, $dbhname, $wpdb ) {
       	dead_db();
       }
       $wpdb->add_callback( 'wpdb_connection_error', 'db_connection_error' );
   
       I thought i could switch the Databse within my Plugin with $wpdb->set_prefix("wp_");
   
       and then before returning
       $wpdb->set_prefix("wp2_");
       ```
   
 * Thx for your help!
 * Best regards
 * Bjoern
 * [https://wordpress.org/plugins/hyperdb/](https://wordpress.org/plugins/hyperdb/)

Viewing 1 replies (of 1 total)

 *  [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/2-wp-installtion-sharing-posts/#post-5984058)
 * Looking for something Similar did you find a Solution?

Viewing 1 replies (of 1 total)

The topic ‘2 WP Installtion sharing Posts’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/hyperdb_33353d.svg)
 * [HyperDB](https://wordpress.org/plugins/hyperdb/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hyperdb/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hyperdb/)
 * [Active Topics](https://wordpress.org/support/plugin/hyperdb/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hyperdb/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hyperdb/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/2-wp-installtion-sharing-posts/#post-5984058)
 * Status: not resolved