As far I researched separate WordPress installation with separate database is not possible using WordPress default trick unless you do some other tricks like “Logging in through API” or any kind of that.
So in your situation I think there are two way you can do that.
You can use WordPress multisite installation and create the second or child blog in a sub directory. This you you can authenticate user once then redirect them to where you want.
Make sure that all the sub sites are installed in same database with different database table prefix. Then define the custom user table in wp-config.php.
For second method-
// Once the sub site has been installed, add these two lines to the sub site’s wp-config.php file, just before this line:
/* That’s all, stop editing! Happy blogging. */
//Add these two lines:
define(‘CUSTOM_USER_TABLE’, ‘wp_users’);
define(‘CUSTOM_USERMETA_TABLE’, ‘wp_usermeta’);`
// Make sure you replace “wp_” by the first website table prefix.
If you get don’t have sufficient permissions error on profile page like below-
You do not have sufficient permissions to access this page.
Then in your sub site WordPress installation, wp-config.php, under
define(‘CUSTOM_USERMETA_TABLE’, ‘wp_usermeta’); add-
define(‘CUSTOM_CAPABILITIES_PREFIX’, ‘wp_’);
Then you have to find this line in wp-includes/capabilities.php
$this->cap_key = $wpdb->prefix . ‘capabilities’;
and replace it with-
if (defined (‘CUSTOM_CAPABILITIES_PREFIX’)) {
$this->cap_key = CUSTOM_CAPABILITIES_PREFIX . ‘capabilities’;
} else {
$this->cap_key = $wpdb->prefix . ‘capabilities’;
}`
If you want to stay logged in to all site then you need to set all the WordPress sites to use the same cookies. At the moment each website has its own cookies parameters, so your two websites have to use the same cookies parameters. So, still in wp-config.php of the sub site, change the COOKIE_DOMAIN with the url of the parent site:
`
define(‘COOKIE_DOMAIN’, ‘.domain.com’); //replace with your domain name (the parent site)
define(‘COOKIEPATH’, ‘/’);
Hope that helps.
-
This reply was modified 3 years, 7 months ago by will652.
-
This reply was modified 3 years, 7 months ago by will652.