Slide 1

Slide 1 text

WORDPRESS MULTISITE ENVIRONMENT

Slide 2

Slide 2 text

GREETINGS EARTHLINGS @acodesmith | acodesmith.com | Adam Smith

Slide 3

Slide 3 text

WORDPRESS AS A SINGLE BLOG

Slide 4

Slide 4 text

SINGLE BLOG ★User roles are set for the entire site. ★One theme is activated at a time. ★Plugins are managed on a case by case basis. ★All tables share the same prefix. 
 For example: wp_posts

Slide 5

Slide 5 text

HOW WORDPRESS WORKS AS A MULTISITE

Slide 6

Slide 6 text

A queen bees pheromones affects social behavior, maintenance of the hive, swarming, and mating behavior.

Slide 7

Slide 7 text

MULTISITE ★User roles are set on a site by site basis. ★Themes are approved by the site admin then activated per site. ★Plugins can either be Network Activated or on a site by site basis. ★Each site has it’s own set of tables prefixed by the site ID.
 For example wp_2_posts ★Site IDs are auto incremented primary keys in the wp_blogs table

Slide 8

Slide 8 text

USER ROLES ★The super admin can access each different site dashboard. ★The super admin can approve which themes can be activated. ★The super admin can Network Activate plugins. ★The super admin can create a new site and add users to that site. ★A user for one site can only access their site dashboard.

Slide 9

Slide 9 text

THEMES ★The super admin approves which themes can be used by other sites. ★Each site selects a theme. ★All themes live in the themes folder. ★Multiple sites can use the same theme. ★Make changes to one theme, updates all site using that theme.

Slide 10

Slide 10 text

PLUGINS ★The super admin can Network Active a plugin. ★A Network Activated plugin is used by all sites and can not be excluded by one site. ★A single site can activate a plugin, just like normal, for that site only. ★Plugins which generate custom tables use the site prefix.
 For example:
 wp_2_woocommerce_sessions

Slide 11

Slide 11 text

TABLES ★WordPress creates a new table called wp_blogs ★The blog_id field in wp_blogs is used as a prefix for each site.
 For example: blog_id 2 is used to create wp_2_posts ★WordPress creates new post, postmeta, taxonomy, terms, options, comments, etc.. ★Each site does NOT get a new users table. All sites share a common wp_users table.

Slide 12

Slide 12 text

TURN ANY WORDPRESS SITE INTO A MULTISITE

Slide 13

Slide 13 text

/* Multisite */ define( 'WP_ALLOW_MULTISITE', true );

Slide 14

Slide 14 text

DOUBLE CHECK AND BACK UP EVERYTHING ★ Installation and Server Requirements ★ mod_rewrite must be enabled. ★ site can’t be hosted on an IP ★ site can’t be hosted on a special port; mysite.com:8080 ★ site can’t be hosted on a localhost url, must use vhost for local install. ★ Backup all tables! ★ Deactivate all your plugins! ★ Subdomain install can’t be ran out of a subfolder, only the root;
 mysite.com/wordpress-installed-here/ 
 mysite.com/wordpress-installed-here/site2

Slide 15

Slide 15 text

TALES OF WOE AND VICTORY

Slide 16

Slide 16 text

WOE ★If the main site goes down they all go down. ★If one site is hacked all sites can be affected. ★One database password for all the sites. ★A bug in a plugin or a theme can affect multiple sites.

Slide 17

Slide 17 text

VICTORY ★New features can be rolled out to all the sites at once. ★Backup one database! ★Fix a bug in one place, you fix a bug for multiple sites. ★Easier to support a large client base.

Slide 18

Slide 18 text

BUILDING A MULTISITE PLUGIN

Slide 19

Slide 19 text

FUNCTIONS FOR VALIDATING THE MAIN SITE FUNCTIONS FOR GETTING THE CURRENT SITE FUNCTIONS FOR SWITCHING TO ANOTHER SITE

Slide 20

Slide 20 text

CHECK IF THE USER HAS ACCESS TO A CERTAIN SITE Could be used to show beta features to special users for certain blogs.

Slide 21

Slide 21 text

GET DETAILS ABOUT A BLOG BASED ON THE BLOG_ID

Slide 22

Slide 22 text

TABLE PREFIX ★Using the global $wpdb object to obtain the prefix.
 For example: $wpdb->prefix ★Use the prefix when building custom tables. ★Use the prefix when writing raw SQL queries.

Slide 23

Slide 23 text

HOOK FIRES WHEN A NEW SITE IS CREATED HOOK FIRES WHEN A SITE IS REMOVED HOOK FIRE WHEN A SITE IS ARCHIVED https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-admin/includes/ms.php

Slide 24

Slide 24 text

WHY MULTISITE

Slide 25

Slide 25 text

WHY MULTISITE ★Software as a service platform ★Managing multiple clients in one controlled space ★Repeatable service model ★Whitelabel products

Slide 26

Slide 26 text

QUICK DEMO AND QUESTIONS