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 |
---|---|
1412 | * @since 3.4.0 |
1413 | * @since 4.4.0 The `$option` parameter was added. |
1414 | * @since 4.7.0 The `$network_id` parameter was added. |
1415 | * |
1416 | * @param mixed $default The value to return if the site option does not exist |
1417 | * in the database. |
1418 | * @param string $option Option name. |
1419 | * @param int $network_id ID of the network. |
1420 | */ |
1421 | return apply_filters( "default_site_option_{$option}", $default, $option, $network_id ); |
1422 | } |
1423 |
|
1424 | if ( ! is_multisite() ) { |
1425 | /** This filter is documented in wp-includes/option.php */ |
1426 | $default = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); |
1427 | $value = get_option( $option, $default ); |
1428 | } else { |
1429 | $cache_key = "$network_id:$option"; |
1430 | $value = wp_cache_get( $cache_key, 'site-options' ); |
1431 |
|
1432 | if ( ! isset( $value ) || false === $value ) { |
1433 | $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); |
1434 |
|
1435 | // Has to be get_row() instead of get_var() because of funkiness with 0, false, null values. |
Line | Code |
1440 | } else { |
1441 | if ( ! is_array( $notoptions ) ) { |
1442 | $notoptions = array(); |
1443 | } |
1444 |
|
1445 | $notoptions[ $option ] = true; |
1446 | wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
1447 |
|
1448 | /** This filter is documented in wp-includes/option.php */ |
1449 | $value = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); |
1450 | } |
1451 | } |
1452 | } |
1453 |
|
1454 | if ( ! is_array( $notoptions ) ) { |
1455 | $notoptions = array(); |
1456 | wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
1457 | } |
1458 |
|