A WordPress-centric search engine for devs and theme authors

get_site_meta ›

get_site_meta ( $site_id, $key = '', $single = false )
Parameters: (3)
  • (int) $site_id Site ID.
    Required: Yes
  • (string) $key Optional. The meta key to retrieve. By default, returns data for all keys. Default empty.
    Required: No
    Default: (empty)
  • (bool) $single Optional. Whether to return a single value. Default false.
    Required: No
    Default: false
  • (mixed) Will be an array if $single is false. Will be value of meta data field if $single is true.
Defined at:

Retrieves metadata for a site.


function get_site_meta( $site_id, $key = '', $single = false ) {
	// Bail if site meta table is not installed.
	if ( ! is_site_meta_supported() ) {
		/* translators: %s: database table name */
		_doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.0.0' );
		return false;

	return get_metadata( 'blog', $site_id, $key, $single );