We’ve done a lot of work with WordPress Multisite over the past few years, setting it up for clients like Fantasy Sports Warehouse and RecruitingDaily, amongst others.
If you’re not familiar with Multisite, check out the article in the WordPress codex about it, but essentially, it lets you take one WordPress install and create multiple sites out of it.
Believe it or not, the entire WordPress.com blogging network runs off of one WordPress Multisite install. It’s pretty powerful.
So while you’re probably not going to create a blogging network yourself, Multisite can be very useful. It’s a great way to segment off sections of your site into silos for specific users or topics of discussion, and can also be used to manage multiple totally different sites from one backend.
Here’s a few tips to make the most out of WordPress Multisite — straight from our work.
For publications using Multisite, where each site is a different content area, you’re obviously going to want to aggregate all of your posts in one section — almost always your homepage.
There are plugins – like Network Latest Posts – that allow you to pull recent posts from across your network into a shortcode or widget, but their display options aren’t flexible without plugin hacking.
WordPress MU Sitewide Tags Pages takes your posts and aggregates them into a new site or your “main” site, allowing you to treat them like any other list of posts. It’s the easiest way to display them on your homepage with enough flexibility to adjust layout and styling.
Since Multisite treats each site as a totally separate site, if you’re planning to use it with the section approach I described above, you need to have smart user management. So, for example, if you have writers that write in multiple sections, they need to be set up as users in all of those sections.
The ideal user role for someone working in every site/section is Super Admin, since that gives access to everything out of the box. BUT, it literally gives access to everything, including theme and plugin editing, permalink changes, etc. It’s not a role you want to give someone who simply needs to create posts in every section.
So if you have users set as editors or authors, and want to keep their user roles synced throughout every site, you need a function to make it happen. Try this one (via guvnr).
add_action('set_user_role', 'sync_user_roles', 10, 2);
function sync_user_roles($user_id, $role) {
// ensure this is a WordPress Multisite setup
if (!is_multisite() || !is_main_site()) {
return;
}
// Grab some initial data
$blogs = get_blogs_of_user($user_id);
$original_blog_id = get_current_blog_id();
// Remove main site from affected sites
unset($blogs[$original_blog_id]);
// Iterate through blogs of user
foreach ($blogs as $blog) {
// Work with another site
switch_to_blog($blog->userblog_id);
// Grab all user info and update role as in main site
$site_user = get_user_by('id', $user_id);
$site_user->set_role($role);
}
// Back to original main site
switch_to_blog($original_blog_id);
}
We’ve talked about Switch_to_Blog before, but it’s worth bringing up here again.
If you’re developing a theme that gets used for every site in your Multisite, you’re probably going to want to bring in some content from one site into the other sites. Normally, it’s your menu, but it could be content from a particular page or a custom field from a specific post.
One of the most popular plugins for Multisite allows you to treat your network as it’s originally intended: to be totally separate sites.
The WordPress MU Domain Mapping plugin lets you set different domain names for each one of the sites in your network. Meaning, rather than using the default subdomain or subfolder options for the main domain, you can use completely different domains for each one of the sites.
It’s relatively easy to setup, but it does require a bit of tweaking of your server settings if you’re using Cpanel and access to adjust your domain names’ CNAMEs. We used it when we launched the RecruitingDaily Network of sites, and since they’re hosted on WP-Engine, it was incredibly easy to do.