protected function createBook() {
		$host = wp_parse_url( network_home_url(), PHP_URL_HOST );
		if ( is_subdomain_install() ) {
			$domain = $this->getSubdomainOrSubDirectory( $this->targetBookUrl ) . '.' . $host;
			$path = '/';
		} else {
			$domain = $host;
			$path = '/' . $this->getSubdomainOrSubDirectory( $this->targetBookUrl );
		}

		if ( ! $this->targetBookTitle ) {
			$this->targetBookTitle = $this->sourceBookMetadata['name'];
		}

		$user_id = get_current_user_id();
		// Disable automatic redirect to new book dashboard
		add_filter(
			'pb_redirect_to_new_book', function () {
				return false;
			}
		);
		// Remove default content so that the book only contains the results of the clone operation
		add_filter( 'pb_default_book_content', [ $this, 'removeDefaultBookContent' ] );
		$result = wpmu_create_blog( $domain, $path, $this->targetBookTitle, $user_id );
		remove_all_filters( 'pb_redirect_to_new_book' );
		remove_filter( 'pb_default_book_content', [ $this, 'removeDefaultBookContent' ] );
		if ( is_wp_error( $result ) ) {
			return false;
		}

		return $result;
	}
protected function createBook() {
		$host = wp_parse_url( network_home_url(), PHP_URL_HOST );
		if ( is_subdomain_install() ) {
			$domain = $this->getSubdomainOrSubDirectory( $this->targetBookUrl ) . '.' . $host;
			$path = '/';
		} else {
			$domain = $host;
			$path = '/' . $this->getSubdomainOrSubDirectory( $this->targetBookUrl );
		}

		if ( ! $this->targetBookTitle ) {
			$this->targetBookTitle = $this->sourceBookMetadata['name'];
		}

		$user_id = get_current_user_id();
		// Disable automatic redirect to new book dashboard
		add_filter(
			'pb_redirect_to_new_book', function () {
				return false;
			}
		);
		// Remove default content so that the book only contains the results of the clone operation
		add_filter( 'pb_default_book_content', [ $this, 'removeDefaultBookContent' ] );
		$result = wpmu_create_blog( $domain, $path, $this->targetBookTitle, $user_id );
		remove_all_filters( 'pb_redirect_to_new_book' );
		remove_filter( 'pb_default_book_content', [ $this, 'removeDefaultBookContent' ] );
		if ( is_wp_error( $result ) ) {
			return false;
		}

		return $result;
	}
protected function createBook ( ) { $ host = wp_parse_url ( network_home_url ( ) , PHP_URL_HOST ) ; if ( is_subdomain_install ( ) ) { $ domain = $ this -> getSubdomainOrSubDirectory ( $ this -> targetBookUrl ) . '.' . $ host ; $ path = '/' ; } else { $ domain = $ host ; $ path = '/' . $ this -> getSubdomainOrSubDirectory ( $ this -> targetBookUrl ) ; } if ( ! $ this -> targetBookTitle ) { $ this -> targetBookTitle = $ this -> sourceBookMetadata [ 'name' ] ; } $ user_id = get_current_user_id ( ) ; // Disable automatic redirect to new book dashboard add_filter ( 'pb_redirect_to_new_book' , function ( ) { return false ; } ) ; // Remove default content so that the book only contains the results of the clone operation add_filter ( 'pb_default_book_content' , [ $ this , 'removeDefaultBookContent' ] ) ; $ result = wpmu_create_blog ( $ domain , $ path , $ this -> targetBookTitle , $ user_id ) ; remove_all_filters ( 'pb_redirect_to_new_book' ) ; remove_filter ( 'pb_default_book_content' , [ $ this , 'removeDefaultBookContent' ] ) ; if ( is_wp_error ( $ result ) ) { return false ; } return $ result ; }
Create target book if it doesn't already exist.

@since 4.1.0

@return bool | int False if the creation failed; the ID of the new book if it succeeded.
Create target book if it doesn t already exist .