WordPress is_multisite() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Conditional tag

Definition

In WordPress, is_multisite() returns true when the install is a Multisite network, which means many sites share one WordPress. It returns false for a normal single site.

Use it to run code that makes sense only on a network, such as switching between sites or checking network settings.

Syntax

Use it as the test of an if statement.

WordPress
if ( is_multisite() ) {
  // code for the true path
} else {
  // code for the false path
}
CallWhat it does
is_multisite()True on a network install.
! is_multisite()True on a single site.
is_main_site()Ask next if this is the first site of the network.

Turn it on by setting WP_ALLOW_MULTISITE and then using Tools > Network Setup.

Full declaration
WordPress
is_multisite(): bool

Parameters

ParameterDescription
NoneThis function takes no parameters.

Return Value

Return ValueDescription
booltrue if Multisite is enabled, otherwise false.

WordPress Examples

Three short theme examples. Each one shows what prints on the true path and the false path.

Example 1 — Print the install type

Show whether the site is a network.

WordPress
<?php if ( is_multisite() ) {
  echo 'This is a Multisite network.';
} else {
  echo 'This is a single site.';
} ?>

How It Works

  1. is_multisite() checks the install type.
  2. The if branch runs on a network.
  3. The else branch runs on a single site.

Example 2 — Call network functions safely

Use a network function only when it exists.

WordPress
<?php if ( is_multisite() ) {
  echo 'Current site ID: ' . get_current_blog_id();
} ?>

How It Works

  1. get_current_blog_id() returns the ID of the site.
  2. We call it only on a network.
  3. This keeps single-site installs simple.

Example 3 — Loop through sites

Network code that visits each site.

WordPress
<?php if ( is_multisite() ) {
  foreach ( get_sites() as $site ) {
    echo $site->blogname . '<br>';
  }
} ?>

How It Works

  1. get_sites() returns the sites of the network.
  2. The loop prints each site name.
  3. The whole block is skipped on a single site.

Frequently Asked Questions

It returns true or false (a bool). Use it inside an if statement.
Add define( 'WP_ALLOW_MULTISITE', true ); to wp-config.php, then follow Tools > Network Setup.
Yes. It checks the install, so it is true on the main site and on every sub-site.
Use is_main_site() after is_multisite().

Next: is_new_day()

Check if the current post is on a different day than the previous post.

is_new_day() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

13 people found this page helpful