Using WordPress ‘populate_network()’ PHP function

The populate_network() WordPress PHP function populates the network settings for a WordPress multisite installation.


populate_network( $network_id, $domain, $email, $site_name, $path, $subdomain_install );


  • $network_id (int) Optional: ID of the network to populate. Default: 1
  • $domain (string) Optional: The domain name for the network. Example: “”. Default: ”
  • $email (string) Optional: Email address for the network administrator. Default: ”
  • $site_name (string) Optional: The name of the network. Default: ”
  • $path (string) Optional: The path to append to the network’s domain name. Default: ‘/’
  • $subdomain_install (bool) Optional: Whether the network is a subdomain installation or a subdirectory installation. Default: false (subdirectory installation)

More information

See WordPress Developer Resources: populate_network()


Basic example

Populate network settings for a subdirectory installation:

populate_network( 1, '', '[email protected]', 'My Network', '/', false );

Subdomain installation

Populate network settings for a subdomain installation:

populate_network( 1, '', '[email protected]', 'My Network', '/', true );

Custom network ID

Populate network settings with a custom network ID:

populate_network( 2, '', '[email protected]', 'My Network', '/', false );

Custom path

Populate network settings with a custom path:

populate_network( 1, '', '[email protected]', 'My Network', '/custompath/', false );

Different site name

Populate network settings with a different site name:

populate_network( 1, '', '[email protected]', 'Another Network', '/', false );