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
944            * Filter a specific default site option.
945            *
946            * The dynamic portion of the hook name, $option, refers to the option name.
947            *
948            * @since 3.4.0
949            *
950            * @param mixed $default The value to return if the site option does not exist
951            *                       in the database.
952            */
953           return apply_filters( 'default_site_option_' . $option, $default );
954      }
955
956      if ( ! is_multisite() ) {
957
958           /** This filter is documented in wp-includes/option.php */
959           $default = apply_filters( 'default_site_option_' . $option, $default );
960           $value = get_option($option, $default);
961      } else {
962           $cache_key = "{$wpdb->siteid}:$option";
963           if ( $use_cache )
964                $value = wp_cache_get($cache_key, 'site-options');
965
966           if ( !isset($value) || (false === $value) ) {
967                $row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
968
 
Line Code
970                if ( is_object( $row ) ) {
971                     $value = $row->meta_value;
972                     $value = maybe_unserialize( $value );
973                     wp_cache_set( $cache_key, $value, 'site-options' );
974                } else {
975                     $notoptions[$option] = true;
976                     wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
977
978                     /** This filter is documented in wp-includes/option.php */
979                     $value = apply_filters( 'default_site_option_' . $option, $default );
980                }
981           }
982      }
983
984      /**
985       * Filter the value of an existing site option.
986       *
987       * The dynamic portion of the hook name, $option, refers to the option name.
988       *