Sélectionner une page

The Complete Guide To Creating A WordPress Multisite Installation

The Complete Guide To Creating A WordPress Multisite Installation

WordPress introduced their multisite feature back in 2010 in WordPress 3.0. It replaced the older WordPress MU system.

Once the feature is activated on your website, multiple websites can be created from the same WordPress installation. Essentially, one set of WordPress core files powers many websites. Plugins and themes are also shared, however each website has unique directories for media uploads. The same database is also used for all websites, however separate tables are created for each website.

In this article, I would like to speak about the benefits of WordPress multisite and show you how you can activate this feature.

The Benefits of WordPress Multisite

Multisite is a powerful WordPress feature that can be used by small, medium, and large websites. It lets you create multiple virtual websites from one WordPress installation. This lets you turn your website into a network of websites.

With one main installation, you only have to update WordPress, and your themes and plugins, once. Multisite gives you access to all network websites directly through the WordPress admin bar. Bear in mind, however, that sites can only be located at one domain, or on subdomains of your main domain. You cannot use different domain names for network sites. It all has to be located at one domain.

Users can be shared across many websites. Rather than create users for two, three, or more websites; you can assign a user to as many websites as you like. This is particularly useful for administrators and staff. Multisite also allows you to grant access to users to create their own websites. This is the same feature that is used by WordPress’s own WordPress.com network

In short, multisite has a lot of practical uses.

A company can use multisite to make an employee an administrator of their company blog and give them full control over content and users. However, they could avoid any problems associated with novice users by restricting them from modifying themes and plugins

Multisite is also great for creating unique sub sections of your website. For example, you can host your main website at the root of your domain and your directory at directory.yourdomain.com or yourdomain.com/directory/. You could also use multisite for discussion forums, support desks, online shops, and more. Each area of your website can be styled in a unique way that distinguishes it from the main website.

As you know, it can be time consuming managing multiple WordPress websites effectively. That is why many people use services such as ManageWP. When it comes to managing websites, multisite offers many of the same benefits a a WordPress management service offers.

You will be pleased to hear that WordPress multisite is quick and easy to install. Without further ado, let us take a closer look at what you need to do to activate multisite on your website.

How to Install WordPress Multisite

Multisite can be installed on your existing WordPress installation. The only limitation is that it does not work with the default permalink structure; since WordPress needs to be able to add the correct name to sub directories and subdomains.

If you have never used multisite before, it may be prudent to activate multisite on a test website first. This will allow you to get an understanding of how multisite can be set up and prevent you from misconfiguring your live website.

When you do go to activate multisite on your live website, make a point of backing up your files and database before you begin. This will allow you to roll back to a previous version of your website if anything goes wrong.

Those of you who are activating multisite on a fresh WordPress installation have nothing to worry about as you can simply delete your data and re-install WordPress 🙂

Thankfully, there is not much that can go wrong during installation as multisite is very easy to set up.

The first thing you need to do is add the following line to your wp-config.php file. It can be placed anywhere above the /* That’s all, stop editing! Happy blogging. */ line.

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

Failure to add the code above will stop you from accessing the network setup page.

Not Defined Multisite

You will see this error message if you don’t enable multisite in your wp-config.php file.

Once you have enabled multisite through wp-config.php and saved the file, you will see a new option in your tools menu entitled “Network Setup” (located at www.yourdomain.com/wp-admin/network.php).

Network Setup Menu Link

A setup page for your network will now be displayed in your main menu.

The network setup page will help you install multisite. Before proceeding with the installation, you need to deactivate all of your WordPress plugins. This is a precautionary measure that avoids any conflictions occurring.

Deactivate All WordPress Plugins

You need to deactivate all plugins in order to proceed with the installation.

You can then proceed to the installation page.

At this stage, you may see a warning message that advises you to change your site url to yourdomain.com instead of www.yourdomain.com. This is to avoid any links having the www prefix. Note that you can still install multisite if this message is displayed.

Create Network Sites

The “Create a Network of WordPress Sites” page.

If you do remove the www prefix from your site url, the warning will disappear.

Create a Network of WordPress Sites

The server address warning will disappear if you change your site url.

You will notice in the image above that another warning is displayed because my test website is installed in a sub directory (i.e. mydomain.com/wordpress/). This means that any network websites I create will also have to be installed in a sub directory.

Create Network Sub Directories

The message you will see if your existing website is installed in a sub-directory.

If WordPress is installed in the root of your domain, you may receive a warning that states that your network must use sub-domains. This will be displayed if your WordPress website is older than one month.

WordPress forces you to choose subdomains after one month to avoid any permalink confliction between pages and sites that can occur with sub directory installations. For example, it would stop a page at www.yourdomain.com/news conflicting with a site located at www.yourdomain.com/news.

I understand WordPress’s reasoning for this, though I think it would be better if they simply warned users of this risk, but still gave users the option of choosing a sub directory installation instead of a subdomain. This would allow WordPress users to change the permalink of pages before installing multisite. It is also worth noting that the same kind of problem can arise if someone adds a site with the same name as an existing subdomain.

Create Network subdomains

The message you will see if your existing website is installed in the root of the domain.

I installed multisite on a few existing websites of mine, therefore I was only given the option of using a subdomain or sub directory.

If you activate multisite on a fresh WordPress installation (i.e. less than one month old), you will see an option to choose either subdomains or sub directories.

Subdomains and Sub Directories

WordPress allows you to choose a subdomain or sub directory.

After deciding on whether to use a subdomain or sub directory structure (or had it decided for you), you can enter your network details. All you need to do is enter the name of your network and admin email address.

Install Your Network

You only need to complete two simple fields in the installation page.

Once you click the install button, WordPress will add the necessary multisite tables to your WordPress database. You will then be taken to the next part of the installation. In this step, you will be required to add a piece of code to your wp-config.php file and your .htaccess file.

If you backed up all of your website files and database previously, you will already have a backup of your wp-config.php and .htaccess file. If you haven’t backed them up by this stage, make a point of doing it now. This will help you revert back to a normal WordPress installation later.

Enabling the Network

Your website’s wp-config.php and .htaccess files need to be updated.

The code that needs to be added to these files depends on your existing website structure; and whether you are using a subdomain or sub directory structure for your network.

For example, the code I had to add to my test website was:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'mydomain.com');
define('PATH_CURRENT_SITE', '/wordpress/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

The current path and subdomain statements would be different if I had installed my test website in the root of the domain. I would have to use this code:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'mydomain.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Remember to add the above code to your wp-config.php file before the /* That’s all, stop editing! Happy blogging. */ line. It is best to place the code below the multisite definition line you added to the file previously.

The code that I had to add to my .htaccess website can be seen below. As you can see, the code takes into account that my test website was installed in a sub directory named wordpress. The code you need to add to your .htaccess file will be different.

RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]

Please be aware that the above code needs to replace any existing WordPress rules in your .htaccess file. It should not just be added to the file It needs to be added between the # BEGIN WordPress and # END WordPress tags.

# BEGIN WordPress
<IfModule mod_rewrite.c>

New .htaccess code goes here

# END WordPress

Your .htaccess code will look something like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress

* Note: I shared examples of the code you will need to add to your website to help you understand what needs to be added to your files. Do not copy and paste the above code into your own files. You need to use the unique code WordPress gives you. The code above is merely for illustration purposes.

Once you have updated your wp-config.php and .htaccess files, you should reload your website. You will be asked to login again. Once you have done this, you will be taken to your network dashboard.

Here is a quick recap of these steps:

  • 1. Add define( ‘WP_ALLOW_MULTISITE’, true );
    to your wp-config.php file
  • 2 (a). Visit the network setup page
  • 2 (b). Choose either a subdomain or sub directory structure
  • 2 (c). Enter your network name
  • 2 (d). Enter your admin email
  • 3. Update your wp-config.php file with the code provided
  • 4. Update your .htaccess file with the code provided
  • 5. Log back in to your website

I installed multisite many times and did not experience any problems.

With one installation, I could not visit a network site I created as the page was caught in a redirect loop. I resolved this issue by simply deleting the code in the .htaccess file and restarting the installation process.

This error was not caused by WordPress multisite. The error occurred because I did not remove code correctly from the .htaccess file after uninstalling and reinstalling multisite. The redirect problem I experienced is a reminder that whenever you experience a problem during the installation process, the best thing to do is retrace your steps and start again 🙂

Configuring Network Subdomains

In the installation guide above, the process of setting up a multisite network that uses subdomains is exactly the same as setting up a multisite network using directories.

However, subdomains requires a little more configuration after you have followed the above steps.

The first thing to do is check with your hosting company to verify that your hosting account supports subdomains. You also need to ensure that WordPress is installed in the root of your domain, as subdomains do not work when WordPress is located in a sub directory.

Next, you need to map each subdomain to your WordPress installation i.e. the same directory as your website’s wp-config.php file.

There are a few ways to do this. WordPress suggests one of the following methods:

  • Configuring wildcard subdomains
  • Configuring virtual hosts, specifying the same document root for each
  • Creating addon domains or subdomains in cPanel or in a similar web hosting control panel

Creating a wildcard subdomain through your hosting control panel is one of the easiest ways to handle this issue. Every hosting control panel I have ever used has a dedicated page that allows you to create and manage subdomains.

The screenshot below highlights what the subdomains menu link looks like in cPanel.

cPanel subdomains Menu Link

In most hosting control panels, there is a dedicated page to managing subdomains.

To create a wildcard, all you need to do is add an asterisk (*) as the subdomain. You also need to specify the document root i.e. the location of your WordPress installation.

By default, cPanel will add the correct path to your home directory; however you may have to specify this manually in other hosting control panels.

Create a Wildcard subdomain

Creating a wildcard subdomain will only take you a minute.

If you already use subdomains, you probably do not want to use a wildcard; as it would inadvertently redirect your existing subdomains.

For example, if your forums are located at forums.yourdomain.com and your help desk is located at support.yourdomain.com, you cannot use a wildcard subdomain as it would redirect those domains to your home page. Therefore, you need to create a subdomain manually for each website you add to your network.

This should not be a problem if you are creating all sites in the network yourself (i.e. you do not allow users to create network sites). It is, at best, a minor inconvenience.

Create a Specific subdomain for a Site

You can create subdomains manually for each site.

As long as you point your subdomains to the location of your WordPress installation; WordPress will ensure that everything works correctly.

Changed your mind about which set up you are using? Don’t worry. WordPress allows you to switch from a subdomain configuration to a sub directory configuration; and vice-versa.

All you have to do is change the SUBDOMAIN_INSTALL call in your wp-config.php file.

If you want to use subdomains, change SUBDOMAIN_INSTALL to true:

define( 'SUBDOMAIN_INSTALL', true );

If you would prefer a path based network that used directories, change SUBDOMAIN_INSTALL to false:

define( 'SUBDOMAIN_INSTALL', false );

Your .htaccess permalink code will also have to be updated if you do make a switch. Therefore, be sure to copy the code from the network setup page (found under the settings menu in the network admin area). Then replace the previous code in .htaccess with the new updated code.

Your New Multisite WordPress Network

When you log back in, WordPress will redirect you to your network dashboard at http://www.yourdomain.com/wp-admin/network/. Your original website dashboard will still be visible at http://www.yourdomain.com/wp-admin/.

Let’s look at your new network admin area.

The first thing you will notice is how different the dashboard looks. It now displays a dashboard widget that lets you search for users and websites. There are also links to create a new user and create a new site.

New WordPress Dashboard

You can manage all users and websites via the admin area.

The admin bar displays a network admin dropdown menu that links to the main areas of the network administration area. This includes sites, users, themes, and plugins.

A menu is also displayed for your main website underneath. Links include the site dashboard, new post, manage comments, and visit site.

These network menus are displayed on every site on the network. This allows you to change from one website to another with ease.

Network Menus

You can access all network websites through the WordPress admin bar.

The sites page lists all of the sites in your network. For each website, it details the path name, the date of the last update, the creation date, and the users who are assigned to that website.

Sites List

The sites page is a practical way of viewing all sites in the network.

The users page shows you when a user account was created and with what sites they are associated. WordPress also creates a new user group called “Super Admin”.

While administrators have full permissions to modify the website they are assigned; super administrators have admin privileges for all websites in the network. Your own account will automatically be upgraded to the super admin role once you install multisite.

Users Page

The users page highlights what websites a user is associated.

The network theme page looks different to the main themes page of a regular WordPress page. In many respects, the themes page works in the same way as plugins do. Each theme can be enabled or disabled for the network. Any themes that had been installed on your website before multisite was activated will be listed on this page.

Themes Page

The network theme page lists all of your installed WordPress themes.

By default, site administrators cannot install themes or plugins. They can only activate a theme or plugin from a list of the themes and plugins you enabled for the network.

Network Enabled Themes

Only network enabled themes are displayed to website admin.

The plugin User Role Editor has full support for multisite. It can be used to grant additional permissions to site administrators. Using User Role Editor, I was able to give myself permission to manage the network, manage network options, manage network plugins, and manage network themes.

Manage Network Options

User Role Editor allows you to enhance the permissions of administrators.

By default, User Role editor allows site administrators to modify their own permissions (as shown in the above screenshot). You obviously need to trust a site administrator completely before offering them this level of control.

If you want to activate User Role Editor on your network, but do not want to allow site administrators to modify their own permissions; then you need to visit the User Role Editor settings page and deselect the option entitled “Show Administrator role at User Role Editor”.

This allows site administrators to modify user permissions of all user group permissions below them; however it ensures they cannot grant themselves the ability to modify your network settings, themes, and plugins.

User Role Editor Options

Ensure you configure user role editor correctly in the network admin area.

The network plugin system works in the same way as themes. You need to activate a plugin for the network in order for it to be made available to all site administrators. This is useful if you want to avoid people activating plugins that use up a lot of resources.

Plugins Page

Plugins need to be activated for the network in order for site admin to use them.

The settings menu displays a link to a network setup page. This page provides a handy reference of the code that you previously added to your website’s wp-config.php and .htaccess files (note that the network setup page will no longer be displayed in the tools menu of your main WordPress installation).

I will show you the network settings page in more detail in the next section 🙂

Settings Menu

The network settings menu.

At the bottom of the network admin menu is an updates menu. The available updates page is exactly the same as the one on a regular WordPress website. It allows you to update WordPress, themes, and plugins.

WordPress Updates

The available updates page is identical to the one you will find on a regular WordPress installation.

There is also an option to Upgrade Network. This will go through each site on your network and update their core files. It processes five websites at a time.

It is a useful feature that allows you to quickly update all websites in your network at the click of a button.

Upgrade Network

The Upgrade Network option makes upgrading WordPress a breeze.

Configuring Your Multisite Installation

The network settings page controls how your network is set up. At the top of the page is the operational settings area. This allows you to modify the network title and admin email that you defined when you first set up multisite.

Operational Settings

You can change your network title and admin email at any time.

The registration settings area lets you control what users can do. When you initially set multisite up, registration will be disabled. You can change this so that anyone can register or so existing users can add new websites. Alternatively, you can allow users to register and create a new website. This is the way a blog network such as WordPress.com is configured.

Registrations can be limited to certain domains. This is a useful feature for companies. For example, Elegant Themes could limit registrations to those who sign up with an @elegantthemes.com email address.

Open networks can also ban domains. This may be necessary if you are receiving a lot of spam registrations from one specific domain.

Registration Settings

If you desire, new users can register and add new sites to your network.

The new site settings area lets you modify the email template that is sent to users when they create an account. The email that is sent to them after they have created their site can also be amended.

You can also change the content that is used for the first post, page, comment, comment author, and comment url.

New Site Settings

New site settings allows you to modify the content that is added to a new site.

In the last section, WordPress lets you control the total storage space that is available for sites. The maximum file upload size and the type of files that can be uploaded, can also be adjusted.

Upload Settings

Limiting the amount of storage for new sites is important if you want to keep storage and bandwidth under control.

These are the only settings multisite offers. It is quite surprising when you think about it. Particularly when you consider that multisite is powerful enough to host a network of hundreds, or even thousands, of websites.

Perhaps it is this simplicity that makes WordPress multisite so powerful. What do you think?

Adding a New Site to Your Network

All you have to do to add a new site to the network is complete three fields. You need to confirm the site address, the site title, and the admin email.

With a sub directory configuration, the name you enter will define the path of the sub directory e.g. www.yourdomain.com/news/. With a subdomain configuration, it will define the subdomain i.e. news.yourdomain.com

If a user in your network has the same email address as the admin email you define, they will be added as an administrator of that site. If not, WordPress will create a new user account and then email the administrator their login details.

Add New Site

Adding a new site to the network only takes a few seconds.

Once you have added your site, it will be listed in your sites page. There are quick links on this page that allow you to visit the site dashboard and visit the front end of the website.

You can also deactivate the site, mark it as spam, or archive it. Deactivating a site will remove it from public view, while archiving will allow the public to continue to view the website, but stop the site administrator from updating it i.e. it becomes read only.

Note that moderation links such as spam, deactivate, delete, etc; are not available for the main WordPress installation. Of course, if your main website was deleted, the whole network would crumble 🙂

Site List Links

The sites list page is essential for managing your network sites.

Clicking on the edit link will allow you to modify site details. The info tab displays the site domain, path, registration date, and the date of the last update.

Moderation checkboxes can be found at the bottom that allow you to deactivate, delete, spam, and archive the website. There is also an option entitled mature which allows you to designate the website as adult content. This will stop the site from being listed publicly on your network.

Edit Site Info

Important site settings can be changed from the info tab.

The users tab lets you see all the users that are assigned to a site. You can edit and delete users from this page. There is also an option to quickly change the user group of a user.

Existing users from your network can be assigned to the site on this page. New users can also be added.

Edit Site Users

The users tab allows you to manage all users for a particular site.

The themes tab shows how all the sites that are enabled and disabled for a site. You may recall the main themes tab that I spoke about earlier which allows you to enable and disable themes for the whole network. This tab allows you to overwrite those network settings and enable or disable a theme for a specific site.

Edit Site Themes

Themes can be enabled and disabled for a site via the themes tab.

The site settings page lists all settings for a site. It works in the same way as the hidden WordPress options page (i.e. the one at www.yourdomain.com/wp-admin/options.php).

Edit Site Settings

All settings can be modified through the settings tab.

How to Uninstall Multisite

You may find that multisite does not fit your requirements. Fear not, as multisite is very easy to deactivate. All you have to do is work backwards and remove the changes you made earlier.

There are three steps you need to do follow to remove multisite:

  1. Remove the multisite code from your wp-config.php file
  2. Remove the multisite code from your .htaccess file
  3. Remove multisite data from your website database
  4. Remove media files that have been uploaded to network sites

Once you have completed all four steps, your website will be a regular WordPress website once again.

Please note that only the first two steps need to be performed in order for your website to return to a normal WordPress website.

If you are considering adding multisite again in the future, but want to change back to a regular WordPress website in the meantime, you may want to keep all network data in your database.

In a future re-installation of multisite, WordPress will give you a warning if network data already exists, and advise you to remove network tables before proceeding with the installation. This warning can be disregarded as you would not be clicking on the install button and adding new tables to your database. You would simply be re-enabling multisite and changing your permalink structure once again.

Existing Network Detected

WordPress warns you if you have already installed multisite.

I recommend removing all multisite data from your website if you have no intention of activating multisite on your website again.

Let us look closer at what you need to do to remove multisite.

Step 1: Remove the Multisite Code From Your wp-config.php File

The first thing you should do is remove the code you added to your wp-config.php during the installation process. There are two ways to do this.

One way is to simply upload your backed up wp-config.php file to overwrite the one in your server. The other is to delete the code from the file directly.

The code you added to your wp-config.php file earlier should look something like the code below. Simply remove this code and then save the file.

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'mydomain.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Be sure to refer to your backed up wp-config.php configuration file if you are unsure of whether you have removed the correct code.

Step 2: Remove the Multisite Code From Your .htaccess File

The code you added to your website’s .htaccess file will also have to be removed. Again, you can do this by simply uploading your backed up .htaccess file and overwriting the one on your server.

Another way to do it is to modify the code you added earlier. With multisite enabled, the code will look something like this.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress

You may recall that we did not add the above code to the .htaccess file. This code actually replaced the previous code that was in between the # BEGIN WordPress and # END WordPress tags.

To remove the multisite code, all you have to do is delete all of the code between these tags. Then visit your website permalink settings page (www.yourdomain.com/wp-admin/options-permalink.php) and save your permalink settings. This will add the correct permalink code back to your .htaccess file.

Step 3: Remove Multisite Data From Your Website Database

In total, multisite adds six tables to your website database when you activate multisite.

The tables are:

  • wp_blogs
  • wp_blog_versions
  • wp_registration_log
  • wp_signups
  • wp_site
  • wp_sitemeta

If your database prefix for WordPress tables has been configured differently in wp-config.php, the names above will be slightly different. For example, if your prefix is abc, the first table in the above list would be abc_blogs.

Please note that if global terms are enabled on your network, you will also have to delete the table wp_sitecategories (check your database for the wp_sitecategories table if you are unsure as to whether it is enabled). For the rest of this section, I will assume that you do not have this additional table added to your database, though be sure to remove this table if it is present 🙂

In addition to the above six tables, multisite also adds two fields to the wp_users table; spam and deleted. These should also be deleted if you want to completely remove multisite from your website.

Last but not least, you need to remove the tables that WordPress adds for each of network site. In total, nine tables are added for each website you add to your network.

Data can be removed from your database using a database management tool such as phpMyAdmin. This can easily be located through your hosting control panel.


You will find phpMyAdmin listed on the main dashboard of cPanel.

Once you are logged into your database management tool, click on the correct database table for your website.

The tables can be deleted via the structure interface, or via an SQL query. If you want to delete the tables via the structure interface, click on the six tables that you need to delete.

As a reminder, these tables are : wp_blogs, wp_blog_versions, wp_registration_log, wp_signups, wp_site, and wp_sitemeta.

Select the Multisite Database Tables

Select all multisite tables from the database.

Next, scroll down to the dropdown option at the bottom of the page and select DROP.

Drop the Database Tables

Drop the tables to remove all data.

You will then be asked to confirm the deletion of the tables. Take this opportunity to double check that you selected the correct tables for deletion.

Drop Database Tables

Confirm that the six tables should be dropped.

Tables can also be removed by executing the SQL query below. Be sure to adjust the code below to match the table prefix you use on your database.


You can do this in phpMyAdmin via the SQL tab at the top of the page. Other database management tools have a similar option for executing SQL commands.

Drop Table SQL Query

Tables can be deleting using an SQL Query.

Next, confirm that you want to drop the tables.

Confirm Table Drop

You need to confirm that you want the tables deleted.

You will be advised if your query was successfully executed. Don’t worry, you will not run into any problems if you followed the steps above correctly 🙂

SQL Query Success

You will see a message like this if the query executed successfully.

The last thing you need to do is delete the spam and deleted fields from your wp_users database.

Spam Deleted Fields

Multisite adds two additional fields to your wp_users database.

You can do this by executing the SQL query below. Again, make sure you change the prefix of the users table if your website database uses a different prefix.

ALTER TABLE `wp_users` DROP `spam`, DROP `deleted`;

If you installed WordPress multisite, but did not add any additional sites, then you have nothing left to do. Your website will now be clear of all multisite data.

If, however, you did add one or more sites to your network, you still have a little work to do.

Whenever you add a site to your network (not counting the original installation), WordPress adds nine new tables to your database.

The tables are:

  • wp_2_commentmeta
  • wp_2_comments
  • wp_2_links
  • wp_2_options
  • wp_2_postmeta
  • wp_2_posts
  • wp_2_terms
  • wp_2_term_relationships
  • wp_2_term_taxonomy

Each additional site in your network will add nine more tables using your database prefix and blog id. For example, the third website would start with wp_3_, the fourth would use wp_4_, etc.

You therefore need to remove all instances of the nine tables noted above. That means you have nine tables to delete if you added one website to your network, eighteen tables if you added two websites, twenty seven tables if you added three websites, and so on.

If you delete a site through the sites page, WordPress will delete all tables associated with a site. This is the simplest and most practical way of deleting site data.

However, if you have uninstalled multisite, you will be unable to remove site data this way. You will therefore have to delete the data manually through your database management tool (e.g. phpMyAdmin).

The process is the same as last time. You simply select the table rows that need to be deleted and then scroll down to the bottom of the page and select DROP from the dropdown menu.

Network Site Tables

Drop the tables for all the sites on your network.

If you prefer, you can delete the tables by running an SQL Query. Be sure to modify the query for your website database prefix and the correct blog id of the tables you are removing:


Once you have deleted all network site tables, your website database will be clear of all multisite data.

Step 4: Remove Media Files That Have Been Uploaded to Network Sites

I was initially baffled as to where WordPress stores media files that are uploaded to a network site. Mainly because I was unable to find any documentation about this issue online.

After uploading some files to a test site I created on my network, I soon figured out how multisite handles images, videos, and other uploaded files.

The first thing I noticed is that any files that are uploaded to your main website, will continue to be stored in the /wp-content/uploads/ directory using a date structure system. For example, www.yourdomain.com/wp-content/uploads/2014/05/elegantthemes.jpg.

This is good news as it means that media uploads to your main website will always be stored in the same way; whether multisite is activated or not.

Uploads to network sites are handled differently.

Sites Upload Folder

Media files can be found in the sites sub directory.

When the first media file is uploaded to one of your network site, WordPress will create a directory within the uploads directory entitled “sites”. A sub directory is also created using the blog id. Two more sub directories are created for the year and month. Files are therefore stored using the same path structure as your main website, with /sites/{blog_id}/ before date and month.

For example, in a site entitled news, which is the first site in a network, the elegantthemes.jpg image would be saved to www.yourdomain.com/wp-content/uploads/sites/2/2014/05/elegantthemes.jpg.

Please note that this is not the image location that WordPress shows in the media library. Since network sites are created virtually, WordPress states that the image is located at www.yourdomain.com/news/wp-content/uploads/sites/2/2014/05/elegantthemes.jpg.

After uploading the elegantthemes.jpg file, I deleted the site I had uploaded to. Deleting a site completely removes all information about images from your website database. That is, the files will be completely removed from your WordPress media library.

Unfortunately, while deleting a site will delete the corresponding meta information for media files from your database, WordPress does not delete the actual files from your uploads directory. Therefore, you need to manually delete any uploaded media files.

Uploaded File Example

It is easy to locate media files that were uploaded to network sites.

If you are uninstalling multisite, simply go to www.yourdomain.com/wp-content/uploads/ and delete the sites directory. This will delete all the images that were uploaded to your network sites.

If you only want to delete media files for a specific site you have deleted, but want to keep multisite activated, then you need to delete the directory that relates to that site. Remember, images are stored in a sub directory using the blog id.

Therefore, you would delete www.yourdomain.com/wp-content/uploads/sites/2/ to delete all media files uploaded to site 2 and you would delete www.yourdomain.com/wp-content/uploads/sites/15/ to delete all media files uploaded to site 15.

Once you understand how images are stored in a multisite installation, deleting images and other media files from your server is a piece of cake 🙂

WordPress Multisite in Action

I thought it would be good to show you a few examples of multisite in action to illustrate what it can do.

As you know, multisite is the basis of the WordPress.com hosted blogging service; however it is also used by many large corporations and high traffic websites.

The New York Times uses multisite to power over sixty blogs. All blogs are hosted on subdomains.

New York Times Blogs

New York Times powers a large network of blogs with multisite.

The whole BBC America website is also powered by multisite. It uses sub directories and a huge amount of custom themes to manage the many areas of the website.

BBC America

Once you delve into the different shows and blogs, you realise how big the BBC America website is.

The large USA based electronic retailer Best Buy uses WordPress multisite to power the blogs for over one thousand of their stores. This is a sub directory installation that uses the same design for all store blogs.

Best Buy

Best Buy illustrates how useful WordPress multisite can be for companies.

Kevin Smith’s SModcast Internet Radio uses multisite to display custom designs for many different shows and events. It uses a sub directory structure.

SModcast Internet Radio

SModcast Internet Radio shows that multisite is not just for blogs.

Graphics powerhouse Adobe power over 1,200 blogs with WordPress multisite. It has a sub directory structure with custom themes for many areas of the website.

Adobe Blogs

Adobe uses multisite for its huge network for blogs.


I hope you have found this guide on activating WordPress multisite useful.

In preparation for this guide, I installed and uninstalled multisite on three of my websites (two live websites and one test website). I repeated this process on my test website over a dozen times. This allowed me to understand how multisite works and helped me write a better guide.

When I write tutorials such as this, I make a point of testing every major feature I can. This ensures that I do not just take the word of others that something works, or that something does not work.

I do not profess to be an expert on WordPress multisite. Therefore, if you believe that any part of my tutorial is inaccurate or misleading, please let me know in the comment area below. I will do my best to explain myself more clearly, and if needs be, correct any mistakes I made.

Multisite is a feature that makes the WordPress platform even more powerful. It is straight forward to set up and I really loved how intuitive it is to navigate between network websites.

Normally, I talk about the strengths and weaknesses of a product or service in my articles. Although I did install multisite on a live website, I did not go any further than testing that everything was set up correctly.

Therefore, I was not in a position to see what works with multisite, and what did not. I would really have to use multisite for a few weeks on a live website to get a clearer view of the limitations of multisite. Since all data is stored in one database, I suspect that many technical solutions and workarounds exist for large networks to ensure that they run efficiently. However, the fact that multisite powers blog networks with thousands of blogs highlights that it can be done.

Be sure to subscribe to the Elegant Themes blog as in my next article, I will be sharing with you all some great multisite plugins.

For more information about creating a multisite network of websites, please refer to the resources below 🙂

Article thumbnail image by Mert Toker / shutterstock.com

Source link

Poster le commentaire

Votre adresse e-mail ne sera pas publiée.