Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: default_site_option_{$option}

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
981            * Filter a specific default site option.
982            *
983            * The dynamic portion of the hook name, `$option`, refers to the option name.
984            *
985            * @since 3.4.0
986            *
987            * @param mixed $default The value to return if the site option does not exist
988            *                       in the database.
989            */
990           return apply_filters( 'default_site_option_' . $option, $default );
991      }
992
993      if ( ! is_multisite() ) {
994
995           /** This filter is documented in wp-includes/option.php */
996           $default = apply_filters( 'default_site_option_' . $option, $default );
997           $value = get_option($option, $default);
998      } else {
999           $cache_key = "{$wpdb->siteid}:$option";
1000           if ( $use_cache )
1001                $value = wp_cache_get($cache_key, 'site-options');
1002
1003           if ( !isset($value) || (false === $value) ) {
1004                $row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
1005
 
Line Code
1007                if ( is_object( $row ) ) {
1008                     $value = $row->meta_value;
1009                     $value = maybe_unserialize( $value );
1010                     wp_cache_set( $cache_key, $value, 'site-options' );
1011                } else {
1012                     $notoptions[$option] = true;
1013                     wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1014
1015                     /** This filter is documented in wp-includes/option.php */
1016                     $value = apply_filters( 'default_site_option_' . $option, $default );
1017                }
1018           }
1019      }
1020
1021      /**
1022       * Filter the value of an existing site option.
1023       *
1024       * The dynamic portion of the hook name, `$option`, refers to the option name.
1025       *