WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 2030 | * @since 3.4.0 |
| 2031 | * @since 4.4.0 The `$option` parameter was added. |
| 2032 | * @since 4.7.0 The `$network_id` parameter was added. |
| 2033 | * |
| 2034 | * @param mixed $default_value The value to return if the site option does not exist |
| 2035 | * in the database. |
| 2036 | * @param string $option Option name. |
| 2037 | * @param int $network_id ID of the network. |
| 2038 | */ |
| 2039 | return apply_filters( "default_site_option_{$option}", $default_value, $option, $network_id ); |
| 2040 | } |
| 2041 | |
| 2042 | if ( ! is_multisite() ) { |
| 2043 | /** This filter is documented in wp-includes/option.php */ |
| 2044 | $default_value = apply_filters( 'default_site_option_' . $option, $default_value, $option, $network_id ); |
| 2045 | $value = get_option( $option, $default_value ); |
| 2046 | } else { |
| 2047 | $cache_key = "$network_id:$option"; |
| 2048 | $value = wp_cache_get( $cache_key, 'site-options' ); |
| 2049 | |
| 2050 | if ( ! isset( $value ) || false === $value ) { |
| 2051 | $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); |
| 2052 | |
| 2053 | // Has to be get_row() instead of get_var() because of funkiness with 0, false, null values. |
| Line | Code |
| 2058 | } else { |
| 2059 | if ( ! is_array( $notoptions ) ) { |
| 2060 | $notoptions = array(); |
| 2061 | } |
| 2062 | |
| 2063 | $notoptions[ $option ] = true; |
| 2064 | wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
| 2065 | |
| 2066 | /** This filter is documented in wp-includes/option.php */ |
| 2067 | $value = apply_filters( 'default_site_option_' . $option, $default_value, $option, $network_id ); |
| 2068 | } |
| 2069 | } |
| 2070 | } |
| 2071 | |
| 2072 | if ( ! is_array( $notoptions ) ) { |
| 2073 | $notoptions = array(); |
| 2074 | wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
| 2075 | } |
| 2076 | |