WP_Site::__construct() WordPress Method

The WP_Site::__construct() method allows a user to create a new wordpress site object. This object can then be used to interact with the wordpress site.

WP_Site::__construct( WP_Site|object $site ) #

Creates a new WP_Site object.


Description

Will populate object properties from the object provided and assign other default properties based on that information.


Top ↑

Parameters

$site

(WP_Site|object)(Required)A site object.


Top ↑

Source

File: wp-includes/class-wp-site.php

	public function __construct( $site ) {
		foreach ( get_object_vars( $site ) as $key => $value ) {
			$this->$key = $value;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.