Function: get_site

get_site( WP_Site | integer | null $site )

Retrieves site data given a site ID or site object.

Site data will be cached and returned after being passed through a filter. If the provided site is empty, the current site global will be used.


Name Type(s) Default Value Description
$site WP_Site | integer | null null

Optional. Site to retrieve. Default is the current site.


WP_Site | null

The site object or null if not found.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.