/ Published in: PHP
There are a few modifications to make to your WP files to share a single database between multiple installs on separate domains.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Install the second WP as normal into the same database as the original with a DIFFERENT table prefix. Activate the theme you want to use. Now edit these files... In wp-config: In wp-includes/capabilities.php: /** * Set up capability object properties. * * Will set the value for the 'cap_key' property to current database table * prefix, followed by 'capabilities'. Will then check to see if the * property matching the 'cap_key' exists and is an array. If so, it will be * used. * * @since 2.1.0 * * @param string $cap_key Optional capability key * @access protected */ function _init_caps( $cap_key = '' ) { global $wpdb; $this->cap_key = CUSTOM_CAPABILITIES_PREFIX . 'capabilities'; } else { $this->cap_key = $wpdb->prefix . 'capabilities'; } else $this->cap_key = $cap_key; $this->caps = &$this->{$this->cap_key}; $this->get_role_caps(); } In the active theme's functions.php: function table_prefix_switch() { global $wpdb; $options = $wpdb->options; //Save the site 2 options table $wpdb->set_prefix('wp_'); //The prefix to site 1 $wpdb->options = $options; //Put the options table back } add_action('init', 'table_prefix_switch');
URL: http://wordpress.org/support/topic/wordpress-25-share-users-table#post-904597