Date post: | 15-Apr-2017 |
Category: |
Technology |
Upload: | taylor-mccaslin |
View: | 1,226 times |
Download: | 2 times |
@Taylor4484 #multisite #WCTO
Best Friend ||Worst Enemy
Multisite Network Do’s & Don’ts
presented by Taylor McCaslin at WordCamp Toronto
on October 3, 2015
@Taylor4484 #multisite #WCTO
@Taylor4484 #multisite
(follow me for the link to these slides & tweet your photos!)
@Taylor4484 #multisite #WCTO
Technical Product ManagerUX Designer
Interaction Designer
BA, Theatre & DanceCertificates in Business, Computer Science, Digital Art & Media
Taylor McCaslin
@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
@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”
@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
●
○
Multisite
●
○
Best Friend || Worst Enemy
@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
@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
@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
@Taylor4484 #multisite #WCTO
The Network Admin /wp-admin/network
@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!
@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)
@Taylor4484 #multisite #WCTO
ALWAYS use CNAMES
@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
@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
@Taylor4484 #multisite #WCTO
Shared Users
● Caution: User profiles are the same for all sites
@Taylor4484 #multisite #WCTO
Individual Multisite Author
@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
@Taylor4484 #multisite #WCTO
Child Themes on Multisite
https://wordpress.org/plugins/one-click-child-theme/
@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
@Taylor4484 #multisite #WCTO
Settings in two places...
@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
@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
@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
@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
@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
@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
@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
@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'
@Taylor4484 #multisite #WCTO
Multisite Theme Developers Do’s
● Create Child Themes for your Themes● Consider how licensing will work for Networks
@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.
@Taylor4484 #multisite #WCTO
Multisite Use Cases
@Taylor4484 #multisite #WCTO
To multisite or not?
“I want to allow users to create their own sites within a network with some constraints”
@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
@Taylor4484 #multisite #WCTO
Happy Tables Custom WP Admin
@Taylor4484 #multisite #WCTO
To multisite or not?
“I want to centrally manage all my client’s sites”
@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)
@Taylor4484 #multisite #WCTO
To multisite or not?
“I want to have a multisite network where each site is in a different language”
@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
@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”
@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
@Taylor4484 #multisite #WCTO
Best Friend ||Worst Enemy
Multisite Network Do’s & Don’ts
presented by Taylor McCaslin at WordCamp Toronto
on October 3, 2015