wp-includes/option.php:1999Retrieves a network's option value based on the option name.
$network_idint|null$optionstring$default_valuemixedoptionalfalsemixed6 hooks fire while get_network_option() runs, in this order:
Filters the value of an existing network option before it is retrieved.
Filters the value of any existing network option before it is retrieved.
Filters the value of a specific default network option.
Filters the value of a specific default network option.
Filters the value of a specific default network option.
Filters the value of an existing network option.
function get_network_option( $network_id, $option, $default_value = false ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; // Fallback to the current network if a network ID is not specified. if ( ! $network_id ) { $network_id = get_current_network_id(); } /** * Filters the value of an existing network option before it is retrieved. * * The dynamic portion of the hook name, `$option`, refers to the option name. * * Returning a value other than false from the filter will short-circuit retrieval * and return that value instead. * * @since 2.9.0 As `pre_site_option_{$key}`. * @since 3.0.0 * @since 4.4.0 The `$option` parameter was added. * @since 4.7.0 The `$network_id` parameter was added. * @since 4.9.0 The `$default_value` parameter was added. * * @param mixed $pre_site_option The value to return instead of the option value. This differs from * `$default_value`, which is used as the fallback value in the event * the option doesn't exist elsewhere in get_network_option(). * Default false (to skip past the short-circuit). * @param string $option Option name. * @param int $network_id ID of the network. * @param mixed $default_value The fallback value to return if the option does not exist. * Default false. */ $pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default_value ); /** * Filters the value of any existing network option before it is retrieved. * * Returning a value other than false from the filter will short-circuit retrieval * and return that value instead. * * @since 6.9.0 * * @param mixed $pre_option The value to return instead of the network option value. This differs * from `$default_value`, which is used as the fallback value in the event * the option doesn't exist elsewhere in get_network_option(). * Default false (to skip past the short-circuit). * @param string $option Name of the option. * @param int $network_id ID of the network. * @param mixed $default_value The fallback value to return if the option does not exist. * Default false. */ $pre = apply_filters( 'pre_site_option', $pre, $option, $network_id, $default_value ); if ( false !== $pre ) { return $pre; } // Prevent non-existent options from triggering multiple queries. $notoptions_key = "$network_id:notoptions"; $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { /** * Filters the value of a specific default network option. * * The dynamic portion of the hook name, `$option`, refers to the option name. * * @since 3.4.0 * @since 4.4.0 The `$option` parameter was added. * @since 4.7.0 The `$network_id` parameter was added. * * @param mixed $default_value The value to return if the site option does not exist * in the database. * @param string $option Option name.Introduced in 4.4.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$network_id retyped from int to int|null.verified against sourcesrc/wp-includes/option.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.