Title: get_site_meta
Published: February 22, 2019
Last modified: May 20, 2026

---

# get_site_meta( int $site_id, string $key = '', bool $single = false ): mixed

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#wp--skip-link--target)

Retrieves metadata for a site.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#parameters)󠁿

 `$site_id`intrequired

Site ID.

`$key`stringoptional

The meta key to retrieve. By default, returns data for all keys.

Default:`''`

`$single`booloptional

Whether to return a single value.
 This parameter has no effect if `$key` is not
specified.

Default:`false`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#return)󠁿

 mixed An array of values if `$single` is false.
 The value of meta data field if`
$single` is true. False for an invalid `$site_id` (non-numeric, zero, or negative
value). An empty array if a valid but non-existing site ID is passed and `$single`
is false. An empty string if a valid but non-existing site ID is passed and `$single`
is true. Note: Non-serialized values are returned as strings:

 * false values are returned as empty strings (`''`)
 * true values are returned as `'1'`
 * numbers (both integer and float) are returned as strings Arrays and objects retain
   their original type.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#source)󠁿

    ```php
    function get_site_meta( $site_id, $key = '', $single = false ) {
    	return get_metadata( 'blog', $site_id, $key, $single );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ms-site.php#L1090)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ms-site.php#L1090-L1092)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#related)󠁿

| Uses | Description | 
| [get_metadata()](https://developer.wordpress.org/reference/functions/get_metadata/)`wp-includes/meta.php` |

Retrieves the value of a metadata field for the specified object type and ID.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_site_meta/?output_format=md#comment-content-5033)
 2.   [lordmatt](https://profiles.wordpress.org/lordmatt/)  [  5 years ago  ](https://developer.wordpress.org/reference/functions/get_site_meta/#comment-5033)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_site_meta%2F%23comment-5033)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_site_meta%2F%23comment-5033)
 4. It should probably be noted that this function is **only** available on multisite
    blogs.
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_site_meta%2F%3Freplytocom%3D5033%23feedback-editor-5033)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_site_meta%2F)
before being able to contribute a note or feedback.