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
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘2 WP Installtion sharing Posts’ is closed to new replies.