get_site_option()WP 2.8.0

Retrieve an option value for the current network based on name of option.

No Hooks.

Return

Mixed. Value set for the option.

Usage

get_site_option( $option, $default_value, $deprecated );
$option(string) (required)
Name of the option to retrieve. Expected to not be SQL-escaped.
$default_value(mixed)
Value to return if the option doesn't exist.
Default: false
$deprecated(true|false)
Whether to use cache. Multisite only. Always set to true.
Default: true

Examples

0

#1 Get the network administrator's email [auto-translate]

$admin_email = get_site_option( 'admin_email' );
0

#2 Get siteurl of the main network site

echo get_site_option( 'siteurl' );
0

#3 Set a Default Value

$value = get_site_option( 'i_dont_exist' );

// $value == false

$value = get_site_option( 'i_dont_exist', 'blah' );

// $value == 'blah'

Notes

Changelog

Since 2.8.0 Introduced.
Since 4.4.0 The $use_cache parameter was deprecated.
Since 4.4.0 Modified into wrapper for get_network_option()

get_site_option() code WP 6.4.3

function get_site_option( $option, $default_value = false, $deprecated = true ) {
	return get_network_option( null, $option, $default_value );
}