public function create( $args, $assoc_args ) {
		list( $domain, $path ) = $args;

		$assoc_args = wp_parse_args(
			$assoc_args, array(
				'network_admin'    => false,
				'site_name'        => false,
				'network_name'     => false,
				'clone_network'    => false,
				'options_to_clone' => false,
			)
		);

		if ( $assoc_args['network_admin'] ) {
			$users = new \WP_CLI\Fetchers\User();
			$user  = $users->get( $assoc_args['network_admin'] );
			if ( ! $user ) {
				return new WP_Error( 'network_super_admin', 'Super user does not exist.' );
			}
			$network_admin_id = $user->ID;
		} else {
			$network_admin_id = get_current_user_id();
		}

		$clone_network    = $assoc_args['clone_network'];
		$options_to_clone = false;

		if ( ! empty( $clone_network ) && ! get_network( $clone_network ) ) {
			WP_CLI::error( sprintf( "Clone network %s doesn't exist.", $clone_network ) );

			if ( ! empty( $assoc_args['options_to_clone'] ) ) {
				$options_to_clone = explode( ',', $assoc_args['options_to_clone'] );
			}
		}

		$network_id = add_network(
			array(
				'domain'           => $domain,
				'path'             => $path,
				'site_name'        => $assoc_args['site_name'],
				'network_name'     => $assoc_args['network_name'],
				'user_id'          => get_current_user_id(),
				'network_admin_id' => $network_admin_id,
				'clone_network'    => $clone_network,
				'options_to_clone' => $options_to_clone,
			)
		);

		if ( is_wp_error( $network_id ) ) {
			WP_CLI::error( $network_id );
		}

		WP_CLI::success( sprintf( 'Created network %d.', $network_id ) );
	}
public function create( $args, $assoc_args ) {
		list( $domain, $path ) = $args;

		$assoc_args = wp_parse_args(
			$assoc_args, array(
				'network_admin'    => false,
				'site_name'        => false,
				'network_name'     => false,
				'clone_network'    => false,
				'options_to_clone' => false,
			)
		);

		if ( $assoc_args['network_admin'] ) {
			$users = new \WP_CLI\Fetchers\User();
			$user  = $users->get( $assoc_args['network_admin'] );
			if ( ! $user ) {
				return new WP_Error( 'network_super_admin', 'Super user does not exist.' );
			}
			$network_admin_id = $user->ID;
		} else {
			$network_admin_id = get_current_user_id();
		}

		$clone_network    = $assoc_args['clone_network'];
		$options_to_clone = false;

		if ( ! empty( $clone_network ) && ! get_network( $clone_network ) ) {
			WP_CLI::error( sprintf( "Clone network %s doesn't exist.", $clone_network ) );

			if ( ! empty( $assoc_args['options_to_clone'] ) ) {
				$options_to_clone = explode( ',', $assoc_args['options_to_clone'] );
			}
		}

		$network_id = add_network(
			array(
				'domain'           => $domain,
				'path'             => $path,
				'site_name'        => $assoc_args['site_name'],
				'network_name'     => $assoc_args['network_name'],
				'user_id'          => get_current_user_id(),
				'network_admin_id' => $network_admin_id,
				'clone_network'    => $clone_network,
				'options_to_clone' => $options_to_clone,
			)
		);

		if ( is_wp_error( $network_id ) ) {
			WP_CLI::error( $network_id );
		}

		WP_CLI::success( sprintf( 'Created network %d.', $network_id ) );
	}
public function create ( $ args , $ assoc_args ) { list ( $ domain , $ path ) = $ args ; $ assoc_args = wp_parse_args ( $ assoc_args , array ( 'network_admin' => false , 'site_name' => false , 'network_name' => false , 'clone_network' => false , 'options_to_clone' => false , ) ) ; if ( $ assoc_args [ 'network_admin' ] ) { $ users = new \ WP_CLI \ Fetchers \ User ( ) ; $ user = $ users -> get ( $ assoc_args [ 'network_admin' ] ) ; if ( ! $ user ) { return new WP_Error ( 'network_super_admin' , 'Super user does not exist.' ) ; } $ network_admin_id = $ user -> ID ; } else { $ network_admin_id = get_current_user_id ( ) ; } $ clone_network = $ assoc_args [ 'clone_network' ] ; $ options_to_clone = false ; if ( ! empty ( $ clone_network ) && ! get_network ( $ clone_network ) ) { WP_CLI :: error ( sprintf ( "Clone network %s doesn't exist." , $ clone_network ) ) ; if ( ! empty ( $ assoc_args [ 'options_to_clone' ] ) ) { $ options_to_clone = explode ( ',' , $ assoc_args [ 'options_to_clone' ] ) ; } } $ network_id = add_network ( array ( 'domain' => $ domain , 'path' => $ path , 'site_name' => $ assoc_args [ 'site_name' ] , 'network_name' => $ assoc_args [ 'network_name' ] , 'user_id' => get_current_user_id ( ) , 'network_admin_id' => $ network_admin_id , 'clone_network' => $ clone_network , 'options_to_clone' => $ options_to_clone , ) ) ; if ( is_wp_error ( $ network_id ) ) { WP_CLI :: error ( $ network_id ) ; } WP_CLI :: success ( sprintf ( 'Created network %d.' , $ network_id ) ) ; }
Add a network.

<domain>
: Domain for network

<path>
: Path for network

--user=<id|login|email>
: Set the WordPress user, this will be the administrator for the site and administrator for the network if network_admin is not provided.

[--network_admin=<id|login|email>]
: This will be the administrator for the network.

[--site_name=<site_name>]
: Name of the new network site

[--network_name=<network_name>]
: Name of the new network

[--clone_network=<clone_network>]
: ID of network to clone

[--options_to_clone=<options_to_clone>]
: Options to clone to new network

@since 1.3.0

@param array $args       Positional CLI arguments.
@param array $assoc_args Associative CLI arguments.
Add a network .