45
@Taylor4484 #multisite #WCTO Best Friend || Worst Enemy Multisite Network Do’s & Don’ts presented by Taylor McCaslin at WordCamp Toronto on October 3, 2015

Best Friend || Worst Enemy: WordPress Multisite

Embed Size (px)

Citation preview

Page 1: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Best Friend ||Worst Enemy

Multisite Network Do’s & Don’ts

presented by Taylor McCaslin at WordCamp Toronto

on October 3, 2015

Page 2: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

@Taylor4484 #multisite

(follow me for the link to these slides & tweet your photos!)

Page 3: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Technical Product ManagerUX Designer

Interaction Designer

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

Taylor McCaslin

Page 4: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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: Best Friend || Worst Enemy: WordPress Multisite
Page 8: Best Friend || Worst Enemy: WordPress Multisite

Multisite

Page 9: Best Friend || Worst Enemy: WordPress Multisite

Best Friend || Worst Enemy

Page 10: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

What is Multisite?

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

● Terminology ○ Install: an instance or installation of WordPress

○ Network: a set of subsites that operate within the single WordPress install configured for multisite

○ Site: one of the subsites in the multisite network

Page 11: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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○ trust me, modifying serialized data is not fun

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

Page 12: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

A big happy multisite apartment

Multisite networks are like apartment complexes.

● Shared roof (hosting)● Common spaces (filesystem)● Private apartments (sites)

Be a good neighborDon’t trust strangers! Always Lock your apartment door

Page 13: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

The Network Admin /wp-admin/network

Page 14: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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

● Concerns:○ 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 15: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Subfolders, Subdomains, & 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○ Github.com/humanmade/Mercator

■ sunrise.php

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

Page 16: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

ALWAYS use CNAMES

Page 17: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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 18: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Shared Users

● All blogs have central user management

● Users login once to access all sites on the network○ Doesn’t play well with 2FA plugins

■ You’ll login for every site

■ Duo2, Google Auth, Two Factor Auth, etc

Page 19: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Shared Users

● Caution: User profiles are the same for all sites

Page 20: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Individual Multisite Author

Page 21: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Shared Themes

● Add a theme○ Network Enable (all sites)○ Restrict themes available to use

per site■ Done through the Site -> Edit Site

menu in network admin

● Changes to one theme WILL affect all sites using it

Page 22: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Child Themes on Multisite

https://wordpress.org/plugins/one-click-child-theme/

Page 23: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Shared Plugins

● Install plugins on the network (for your site admins)○ Activate per site (wp-admin)

○ Network Activate (network admin)

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

Page 24: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Settings in two places...

Page 25: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

File Structure Differences

❏ wp-config.php has extra lines

❏ .htaccess has extra lines

❏ wp-content/sunrise.php if you are using domain mapping

❏ wp-content has extra subfolders

Page 26: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

File Structure Differences

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

Page 27: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

DB Structure Differences

Normal WordPress (10)

wp_optionswp_postswp_postmetawp_commentswp_commentmetawp_termswp_term_taxonomywp_term_relationshipswp_users*wp_usermeta*

Multisite Specific (10 + 6)

wp_blogswp_blog_versionswp_registration_logwp_signupswp_sitewp_sitemeta

PER Multisite (10 + 6 + (N * 8))

wp_2_optionswp_2_postswp_2_postmetawp_2_commentswp_2_commentmetawp_2_termswp_2_term_taxonomywp_2_term_relationships

Page 28: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Tables in ONE multisite DB

(10 + 6 + (N * 8)) where n is number of sites 1 site = 24 tables 10 sites = 96 tables

100 sites = 816 tables 1,000 sites = 8,016 tables 10,000 sites = 80,016 tables

95,000,000 sites = 296,000,016 tables WordPress.com, July 2015

Page 29: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Choosing the right 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 (like 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 30: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Pro Dev Do’s

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

● define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true );

○ For large sites: prevents dbDelta() and the upgrade functions from

doing expensive queries against global tables

Page 31: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Multisite Plugin Developer Do’s

● Consider your Network and WP-Admin settings○ Split out these settings if needed

● Cleanup site options on delete○ delete_site_option( $option_name );○ can be expensive

● Cleanup custom site tables on delete● Consider how licensing will work for Networks

Page 32: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Pro Dev Do’s

● add_action( ‘network_admin_menu’, ‘my-settings’ );

○ add extra submenus and menu options to the network admin panel'

Page 33: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Multisite Theme Developers Do’s

● Create Child Themes for your Themes● Consider how licensing will work for Networks

Page 34: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Pro Dev Dont’s

● current_user_can(‘unfiltered_html’)

○ “Allows user to post HTML markup or even JavaScript code in pages, posts, comments and widgets.”

○ 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 35: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Multisite Use Cases

Page 36: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

To multisite or not?

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

Page 37: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

To multisite or not?

“I want to allow users to create their own sites within a network with 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 38: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Happy Tables Custom WP Admin

Page 39: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

To multisite or not?

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

Page 40: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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)○ WP Remote (free, hosted)○ Manage WP (premium, hosted)○ Infinite WP (free, self-hosted with paid addons)○ WP-CLI (script your way to site nirvana)

Page 41: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

To multisite or not?

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

Page 42: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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 43: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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 content”

Page 44: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

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”

● Most likely not Multisite, but maybe● Map domains to categories and tags● Create custom templates for custom posts types, and

category archives

Page 45: Best Friend || Worst Enemy: WordPress Multisite

@Taylor4484 #multisite #WCTO

Best Friend ||Worst Enemy

Multisite Network Do’s & Don’ts

presented by Taylor McCaslin at WordCamp Toronto

on October 3, 2015