WordPress Multisite Network Do’s & Don’ts

33
@taylor4484 #multisite #WCSEA Multisite Network Do’s & Don’ts Experiences From Some Enterprise Solutions presented by Taylor McCaslin at WordCamp Seattle March 28, 2015

Transcript of WordPress Multisite Network Do’s & Don’ts

Page 1: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Multisite Network Do’s & Don’ts

Experiences From Some Enterprise Solutions

presented by Taylor McCaslin at WordCamp Seattle March 28, 2015

Page 2: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Product Manager

UX Designer

Interaction Designer

BA Theatre & DanceCertificates in Business, Computer Science, Digital Art & Media

Taylor McCaslin

Page 3: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Disclaimer

● My advice is based on my experience with what has worked for me in the past

● Every project is unique

● There is an exception to every rule I makeup

● Plugins will do everything I say multisite won’t or shouldn’t

Page 4: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

What people are saying

● “I tried to use multisite to manage multiple sites and just got myself confused”

● “Multisite is amazing, why would anyone not use it?”

● “Multisite is hard”

● “We had a project that was running multisite and we converted it to a standard wordpress install”

● “I don’t use anything but multisite”

Page 5: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

How it’s being used

“multisite is now a utility for managing multiple sites using one installation, where as the original vision was to enable blogging networks“

@jjj on make.wordpress.org/core

Page 6: WordPress Multisite Network Do’s & Don’ts
Page 7: WordPress Multisite Network Do’s & Don’ts

Multisite

Page 8: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

What is Multisite?

● A multisite network is a collection of sub-sites that all share the same single WordPress installation

● Terminology ○ Install: an instance or installation of WordPress○ Network: a set of websites that operate within the single

WordPress install configured for multisite○ Site: one of the subsites on the multisite network

Page 9: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

What ISN’T Multisite?

● A network of sites that can be moved to separate hosts

○ 1 host. 1 install of WordPress. Many sites.

● A set of sites that can easily be separated into their own WordPress installs

○ just trust me here. modifying serialized data is not fun

● A set of sites that can have different IP addresses○ see the first point

Page 10: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

The Network Admin

Page 11: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Open or Closed Site?

● Terminology is hard…. and confusing.

Public Network / Untrusted● Anyone can signup and create a

site (sometimes paid)o WordPress.como Happytables.como University Student Blogs

● Concerts: o file types / uploadso scripts/embedso copyrighto DMCA

Private Network / Trusted● Limited site and user creation

o Wordcamp.orgo Company intranetso University network

colleges ,department, etc● Concerns:

o too many cooks (wanting super admin)o or none at all (no one to manage network)o code changes affect all sites!

Page 12: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Subfolders, Subdomains and Domain Mapping

● 1 primary network domaino sub-domain (I prefer this one)

mysite.com site2.mysite.com site3.mysite.com

o sub-folder

mysite.com/site1

mysite.com/site2

mysite.com/site3

● Domain Mappingo wordpress.org/plugins/wordpress-mu-domain-mapping/

sunrise.php

o Pro-tip: Always use CNAMES!

o Premium plugins exist for selling domains to users (wpmudev.org)

Page 13: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Unified Site Management

● Super Admin Role● manage_network● manage_sites● manage_network_users● manage_network_plugins● manage_network_themes● manage_network_options● unfiltered_html

codex.wordpress.org/Roles_and_Capabilities

Page 14: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Shared Users

● All blogs have central user management

● Users login once to access all sites on the networko Doesn’t play well with alternative login plugins (Duo2, 2FA,

Google Auth) - you’ll login for every site

● Caution: User profiles are the same for all sites

Page 15: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Shared Themes

● Add a themeo Network Enable (all sites)o Restrict themes available

to use per site Done through the Site -> Edit

Site menu

● Remember to add Child Themes!

Page 16: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Shared Plugins

● Install plugin on the networko Activate per siteo Network Activate

● Must Use Pluginso Can’t be deactivated through the admin

● Caution: Some plugins have their own network settings!

Page 17: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

File Structure Differences

❏ /root of WordPress Install

❏ wp-config.php has extra lines

❏ .htaccess has extra lines

❏ wp-content has extra subfolders

Page 18: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

❏ /wp-content/uploads ❏ /2015/

❏ /2014/

❏ /sites/

your primary (first site) site’s media directories

File Structure Differences

❏ 2 ← site ids (second site you made)❏ /2015/❏ /2014/

❏ 3/2015//2014/

❏ ...

Pro tip: rely on host to allow you to grant your site admins access to only specific site directories

Page 19: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

DB Structure Differences

● 17 tables instead of 11● 6 extra tables:

○ wp_blogs○ wp_blogs_versions○ wp_sitemeta

o wp_siteo wp_signupso wp_registration_log

● 9 prefixed tables per every new site!!!

○ wp_6_posts ← prefixed with site id

○ wp_posts ← first site isn’t prefixed

Page 20: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Tables in ONE multisite DB

8 + (9 * n) where n is number of sites 1 site = 17 tables 10 sites = 98 tables 100 sites = 908 tables 1,000 sites = 9,008 tables10,000 sites = 90,008 tables

Page 21: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Hosting

● Use a managed host● Pro-Tips:

o automatic backups with 1 click restore (ability to download backup)

o built in staging sites (that magically with the networked sites)o granular deploy to production controls (deploy only specific

tables)o look for extra security features (automatic ip blacklisting)o know limitations (some hosts don’t allow subdomains or

subfolders)o use version control

● MMSN (massive multisite network) o plan to spend $$$$ or hire a sysadmin

Page 22: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Pro Dev Tips

● define( 'DISALLOW_FILE_MODS', true );o disable the Admin File Editor

● define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true );o Prevents upgrade functions from doing expensive database

queries on global tables

● add_action( ‘network_admin_menu’, ‘my-settings’ );o add extra submenus and menu options to the network admin

panel'

Page 23: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Pro Dev Don'ts

● current_user_can(‘unfiltered_html’)o Just don’t. You will regret this.

● loop through your network siteso Unless you know what you’re doing, you’ll cripple your site

performance, if not crashing your site altogether.

Page 24: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Use Cases

Experiences From Some Enterprise Solutions

Page 25: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I want to allow users to create their own sites within some constraints”

Page 26: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I want to allow users to create their own sites within some constraints”

● Use Multisite!o This is what multisite was made to do, and it does it well!

● Pro-Tip: customize the admin! o WordPress.como Happytables.com

Page 27: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I want to centrally manage all my client’s sites”

Page 28: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I want to centrally manage all my client’s sites”● Don’t use Multisite

● Alternatives:o Jetpack Site Management (update plugins across your site)

o Manage WP (premium)

o Infinite WP (free with paid addons)

o WP-CLI (script your way to site nirvana)

Page 29: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I want to have a multisite network where each site is in a different language”

Page 30: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I want to have a multisite network where each site is in a different language”● Maybe Multisite, Maybe Not

● SEO optimization can be difficult when similar content is across a network of siteso Pro-tip: hreflang tags and canonical links are your friend

● Plugins like WPML are built specifically to do this

Page 31: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I have a lot of content that is very different, and I want all my sites to look different, but it’s still all my stuff”

Page 32: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

To multisite or not?

“I have a lot of content that is very different, and I want all my sites to look different, but it’s still all my stuff”● Maybe Multisite, Maybe Not

● Why not map domains to categories and tags and create custom templates for theme archives and categories

Page 33: WordPress Multisite Network Do’s & Don’ts

@taylor4484 #multisite #WCSEA

Multisite Network Do’s & Don’ts

Experiences From Some Enterprise Solutions

presented by Taylor McCaslin at WordCamp Seattle March 28, 2015