36
@taylor4484 #multisite @WPATX Multisite Network Do’s & Don’ts Experiences From Some Enterprise Solutions presented by Taylor McCaslin at The WordPress Austin Meetup on May 28th, 2015

Multisite WordPres Network Do’s & Don’ts

Embed Size (px)

Citation preview

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

@taylor4484 #multisite @WPATX

Multisite Network Do’s & Don’ts

Experiences From Some Enterprise Solutions

presented by Taylor McCaslin at The WordPress Austin Meetup on May 28th, 2015

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

@taylor4484 #multisite #WPATX

Technical Product ManagerUX Designer

Interaction Designer

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

Taylor McCaslin

Page 3: Multisite WordPres Network Do’s & Don’ts
Page 4: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

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 5: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

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 6: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

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 7: Multisite WordPres Network Do’s & Don’ts
Page 8: Multisite WordPres Network Do’s & Don’ts

Multisite

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

@taylor4484 #multisite #WPATX

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 10: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

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 11: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

The Network Admin

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

@taylor4484 #multisite #WPATX

Open or Closed Site?

● Terminology is hard…. and confusing.

Public Network / Untrusted● Anyone can signup and create a site

(sometimes paid)○ WordPress.com○ Happytables.com○ University Student Blogs

● Concerts: ○ file types / uploads○ scripts/embeds○ copyright○ DMCA

Private Network / Trusted● Limited site and user creation

○ Wordcamp.org○ Company intranets○ University network

■ colleges ,department, etc● Concerns:

○ too many cooks○ or none at all○ code changes affect all sites!

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

@taylor4484 #multisite #WPATX

Subfolders, Subdomains and Domain Mapping

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

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

○ sub-folder■ mysite.com/site1■ mysite.com/site2■ mysite.com/site3

● Domain Mapping○ wordpress.org/plugins/wordpress-mu-domain-mapping/

■ sunrise.php

○ Pro-tip: Always use CNAMES! ○ Premium plugins exist for selling domains to users

(wpmudev.org)

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

@taylor4484 #multisite #WPATX

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 15: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

Shared Users

● All blogs have central user management

● Users login once to access all sites on the network

○ 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 16: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

Shared Themes

● Add a theme○ Network Enable (all sites)

○ Restrict themes available to use per site

■ Done through the Site -> Edit Site

menu

● Pro Tip: Add Site Specific Child Themes (limit the shared nature of themes)

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

@taylor4484 #multisite #WPATX

Shared Plugins

● Install plugin on the network○ Activate per site○ Network Activate

● Must Use Plugins○ Can’t be deactivated through the admin

● Caution: Some plugins have their own network settings!

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

@taylor4484 #multisite #WPATX

File Structure Differences

❏ / root of WordPress Install

❏ wp-config.php has extra lines

❏ .htaccess has extra lines

❏ wp-content has extra subfolders

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

@taylor4484 #multisite #WPATX

❏ /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 20: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

DB Structure Differences

● 17 tables instead of 11

● 6 extra tables:○ wp_blogs○ wp_blogs_versions○ wp_sitemeta

○ wp_site○ wp_signups○ 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 21: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

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 tables

10,000 sites = 90,008 tables

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

@taylor4484 #multisite #WPATX

Hosting

● Use a managed host● Pro-Tips:

○ automatic backups with 1 click restore (ability to download backup)○ built in staging sites (that magically with the networked sites)○ granular deploy to production controls (deploy only specific tables)○ look for extra security features (automatic ip blacklisting)○ know limitations (some hosts don’t allow subdomains or subfolders)○ use version control

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

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

@taylor4484 #multisite #WPATX

Pro Dev Tips

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

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

on global tables

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

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

@taylor4484 #multisite #WPATX

Pro Dev Dont’s

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

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

performance, if not crashing your site altogether.

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

@taylor4484 #multisite #WPATX

A big happy multisite family

Multisite networks are like families.

● Live under the same roof● Share a lot of things● Trust other members of the family

Don’t trust strangers!

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

@taylor4484 #multisite @WPATX

Use CasesExperiences From Some

Enterprise Solutions

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

@taylor4484 #multisite #WPATX

To multisite or not?

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

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

@taylor4484 #multisite #WPATX

To multisite or not?

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

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

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

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

@taylor4484 #multisite #WPATX

To multisite or not?

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

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

@taylor4484 #multisite #WPATX

To multisite or not?

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

● Don’t use Multisite● Alternatives:

○ Jetpack Site Management (update plugins across your site)○ Manage WP (premium)○ Infinite WP (free with paid addons)○ WP-CLI (script your way to site nirvana)

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

@taylor4484 #multisite #WPATX

To multisite or not?

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

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

@taylor4484 #multisite #WPATX

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 sites○ Pro-tip: hreflang tags and canonical links are your friend

● Plugins like WPML are built specifically to do this

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

@taylor4484 #multisite #WPATX

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 34: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

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 35: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite #WPATX

Slides & Links

Available at:

taylormccaslin.com/wpatx

Page 36: Multisite WordPres Network Do’s & Don’ts

@taylor4484 #multisite @WPATX

Multisite Network Do’s & Don’ts

Experiences From Some Enterprise Solutions

presented by Taylor McCaslin