WP_Site
- Since
- 4.5.0
- Source
wp-includes/class-wp-site.php:25
Core class used for interacting with a multisite site.
Description
This class is used during load to populate the $current_blog global and setup the current site.
Compatibility
- WordPress
- since 4.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 2
Every hook that fires from inside WP_Site, in the order it appears in the class, grouped by the method that fires it.
WP_Site::get_details()
- do_action( blog_details )filter_deprecated line 340
- apply_filters( site_details )filter line 349
Properties · 12
$blog_idstringpublic- Site ID.
$domainstringpublic- Domain of the site.
$pathstringpublic- Path of the site.
$site_idstringpublic- The ID of the site's parent network.
$registeredstringpublic- The date and time on which the site was created or registered.
$last_updatedstringpublic- The date and time on which site settings were last updated.
$publicstringpublic- Whether the site should be treated as public.
$archivedstringpublic- Whether the site should be treated as archived.
$maturestringpublic- Whether the site should be treated as mature.
$spamstringpublic- Whether the site should be treated as spam.
$deletedstringpublic- Whether the site should be treated as deleted.
$lang_idstringpublic- The language pack associated with this site.
Methods · 7
- get_instance()Retrieves a site from the database by its ID.
- __construct()Creates a new WP_Site object.
- to_array()Converts an object to array.
- __get()Getter.
- __isset()Isset-er.
- __set()Setter.
- get_details()Retrieves the details for this site.
Source code
#[AllowDynamicProperties]final class WP_Site { /** * Site ID. * * Named "blog" vs. "site" for legacy reasons. * * A numeric string, for compatibility reasons. * * @since 4.5.0 * @var string */ public $blog_id; /** * Domain of the site. * * @since 4.5.0 * @var string */ public $domain = ''; /** * Path of the site. * * @since 4.5.0 * @var string */ public $path = ''; /** * The ID of the site's parent network. * * Named "site" vs. "network" for legacy reasons. An individual site's "site" is * its network. * * A numeric string, for compatibility reasons. * * @since 4.5.0 * @var string */ public $site_id = '0'; /** * The date and time on which the site was created or registered. * * @since 4.5.0 * @var string Date in MySQL's datetime format. */ public $registered = '0000-00-00 00:00:00'; /** * The date and time on which site settings were last updated. * * @since 4.5.0 * @var string Date in MySQL's datetime format. */ public $last_updated = '0000-00-00 00:00:00'; /** * Whether the site should be treated as public. * * A numeric string, for compatibility reasons. * * @since 4.5.0 * @var string */ public $public = '1'; /** * Whether the site should be treated as archived. * * A numeric string, for compatibility reasons. * * @since 4.5.0 * @var string */ public $archived = '0';Changelog
Introduced in 4.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/class-wp-site.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.