Theoretical Multi-Server WordPress Setup with Shared Users

It may be possible. A lot of the core API that deals with logins and cookies is pluggable.

You could replace wp_set_current_user with something that queried your external database rather than the internal one, for instance.

Authentication is already done via a the authenticate filter (wp_authenticate is the function that does this, and the filter is added in wp_signout).

In short, there’s plenty of ways you could hook it, do your thing and change stuff. You would lose, however, almost all of the users API (no get_users, no user admin area, etc), except for your main site, where the user functionality resides.

An alternative approach would be to have all ~5 servers/WP installs share the same, external database server and database. From there, set a custom user table in each wp-config.php, and each separate install with share the same user data. You’ll also need to set a different $table_prefix for each site.

Capabilities and roles will be different on each site, due to the way WordPress stores roles/caps (they get prefixed with $table_prefix). All the core user data, namely usernames, emails and passwords, will be shared between servers.

Of course, this is just a WP multisite install without the convenience of multisite.

Multisite + a domain mapping plugin is probably what you want. Or you could role your own sunrise.php and skip the domain mapping plugin. It should be possible to put multiple applications servers running a WP install with a shared database server. Point all the domains at a load balancer that sends traffic to one of the application servers and you’re done.

Leave a Comment