WordPress Multisite lets you run a network of sites from a single WordPress installation. All sites share the same codebase and plugin/theme files, but each has its own database tables, media uploads, and settings. It’s the technology behind WordPress.com.
Problem: What is WordPress Multisite and when does it make sense to use it instead of running separate single-site installs?
Solution: Enable Multisite by adding two constants to wp-config.php and running the network setup wizard. It's best suited to managing multiple sites under one domain that share themes, plugins, users, and a single database.
Enable Multisite by adding these lines to wp-config.php before the /* That's all, stop editing! */ line:
define( 'WP_ALLOW_MULTISITE', true );
After saving, go to Tools → Network Setup in the admin, choose between sub-domains (site1.example.com) or sub-directories (example.com/site1/), and follow the setup instructions. WordPress will give you additional lines to add to wp-config.php and .htaccess.
Useful functions for working with a network:
// Check if Multisite is active
if ( is_multisite() ) { ... }
// Get current blog ID
$blog_id = get_current_blog_id();
// Switch context to another site
switch_to_blog( 2 );
$posts = get_posts( [ 'posts_per_page' => 5 ] );
restore_current_blog(); // always restore!
// Get all sites in the network
$sites = get_sites( [ 'number' => 100 ] );
// Network-wide option
get_site_option( 'admin_email' );
update_site_option( 'my_network_setting', 'value' );
NOTE: Multisite adds real complexity. Use it when you genuinely need a network of related sites under one roof — franchise sites, university departments, news network. For two or three unrelated sites, separate installs are simpler to manage and safer to update independently.