Changing WordPress Multisite Default Install Settings

Home / Tutorials / Core / Changing WordPress Multisite Default Install Settings

Changing WordPress Multisite Default Install Settings

If you are familiar with WordPress Multisite then you are aware that there are some default configuration done for each new site install. In this tutorial, we are going to change the default install settings. In this tutorial, we are going to change the Sample Page, create categories for each site and update some WordPress options.

What is inside the default multisite install?

By default when you create a new WordPress  blog in a multisite environment, the following are created

  1. A single Page titled Sample Page
  2. A single Taxonomy titled Uncategorized
  3. A single Post titled Hello World
  4. A comment to the Hello World post
  5. Activates  the Welcome Panel in the dashboard for the user

The install settings are created by the function wp_install_defaults, located in wp-admin/includes/upgrades.php

The contents of the function can be found here

 Overriding the function

In order to modify the default install settings, we are going to create a plugin that will override the plugin settings. Let’s start by creating the plugin. Create a folder called mpl-multisite-template then create the file mpl-multisite-template.php. Now within that file, let’s add our plugin headers to it.

Next, let’s copy the entire function wp_install_defaults to our file and we’ll start by modifying it to suit our needs.

Changing the default category

As mentioned before the default category is Uncategorized but for the purpose of this tutorial, we are going to change it to blog, so in your our plugin replace the following

with

Changing our first post

So by now, you have noticed that we can simply modify the text of the function to suit our needs. I personally, dislike the default Hello World post and comment because it is usually the first thing I have to remove from the new site. So, what I would recommend is deleting the scripts that add the post, remove the following from the function

Changing the default page

For the default page, we’re going to change it from Sample Page to Home Page as well add an instruction video for the new site owner. This default page can be a fully configured page, if you know the right shortcodes. Let’s modify the script

1. Change the Page title and slug

to

2. Change the content

 

Next, we’ll update the insert function. We are are going to change the post ID to 1. Also, if you have a theme with page a template for the home page, we can change the page template as well.

Find and change the following from

to

Don’t forget to change the post IDs  for the GUID

3. Changing the site settings

At this point, you can add, update or remove options for the new site. For this tutorial, we are going to create a static home page of the new default page. Let’s add the following to the script

Adding more pages

While we are at it, let’s assume that each new site will have 3 default pages; Home, About Us, Contact Us. Let’s create About Us and Contact Us by adding the following to our script

 

Activating WordPress Multisite Default Install Plugin

mpl-tut-plugin

Our plugin is now full coded, we can go ahead and network activate it in our network. Once activated and we create a new site, our new settings will be used for the new site install.

Full Code

Plugin in action

mpl-tut-homepage

 

mpl-tut-categories mpl-tut-pages

Resources

Create a Network 

WPMU Functions

 

 

Recommended Posts
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search

Fontawesome Animation