WordPress Multi-Site With Multi-Domains

Since the WordPress team introduced the multi-site feature into their software, people have enjoyed having the opportunity to create networks of sites without the sweat of managing different installations of the blogging tool. I've been using this feature myself as a means of writing for several websites hosted on my servers, and to provide a simple website to friends and family who want to share thoughts and pictures with the world. While this feature certainly works very well for people who have many websites under a single domain, there are problems for those who operate with multiple domains.

The Problem:

The WordPress configuration variable DOMAIN_CURRENT_SITE only allows one domain to be recorded. How do users of other sites hosted on other domains log in to their account?

The Answer:

Populate the DOMAIN_CURRENT_SITE value with a variable.

Above the line that reads define( 'DOMAIN_CURRENT_SITE', 'yoursite.com' );, add this:$site_domain = 'yoursite.com';if ( $_SERVER['HTTP_HOST'] != $site_domain ) {$site_domain = $_SERVER['HTTP_HOST'];}and change define( 'DOMAIN_CURRENT_SITE', 'yoursite.com' ); to define( 'DOMAIN_CURRENT_SITE', $site_domain );Once this is done, people will be able to log in to the different sites normally, and it's completely transparent to everyone involved. Done and done.I use one single WordPress installation to handle 13 domains, three of which have several sub-sites running in subdomains, and haven't had a problem since implementing this change.Have any WordPress questions? I'd be happy to help.Note: While it is certainly possible to host multiple domains on a WordPress installation without this little work-around, people are unable to login under any domain that is not the primary. This solution resolves it.

Page generated in roughly: 0.12104 Seconds, 0 API Calls, 5 SQL Queries, 6 Cache Objects