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 |
---|---|
1132 | * @since 3.4.0 |
1133 | * @since 4.4.0 The `$option` parameter was added. |
1134 | * @since 4.7.0 The `$network_id` parameter was added. |
1135 | * |
1136 | * @param mixed $default The value to return if the site option does not exist |
1137 | * in the database. |
1138 | * @param string $option Option name. |
1139 | * @param int $network_id ID of the network. |
1140 | */ |
1141 | return apply_filters( "default_site_option_{$option}", $default, $option, $network_id ); |
1142 | } |
1143 |
|
1144 | if ( ! is_multisite() ) { |
1145 | /** This filter is documented in wp-includes/option.php */ |
1146 | $default = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); |
1147 | $value = get_option( $option, $default ); |
1148 | } else { |
1149 | $cache_key = "$network_id:$option"; |
1150 | $value = wp_cache_get( $cache_key, 'site-options' ); |
1151 |
|
1152 | if ( ! isset( $value ) || false === $value ) { |
1153 | $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); |
1154 |
|
1155 | // Has to be get_row instead of get_var because of funkiness with 0, false, null values |
Line | Code |
1159 | wp_cache_set( $cache_key, $value, 'site-options' ); |
1160 | } else { |
1161 | if ( ! is_array( $notoptions ) ) { |
1162 | $notoptions = array(); |
1163 | } |
1164 | $notoptions[ $option ] = true; |
1165 | wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
1166 |
|
1167 | /** This filter is documented in wp-includes/option.php */ |
1168 | $value = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); |
1169 | } |
1170 | } |
1171 | } |
1172 |
|
1173 | /** |
1174 | * Filters the value of an existing network option. |
1175 | * |
1176 | * The dynamic portion of the hook name, `$option`, refers to the option name. |
1177 | * |