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
959            * Filter a specific default site option.
960            *
961            * The dynamic portion of the hook name, $option, refers to the option name.
962            *
963            * @since 3.4.0
964            *
965            * @param mixed $default The value to return if the site option does not exist
966            *                       in the database.
967            */
968           return apply_filters( 'default_site_option_' . $option, $default );
969      }
970
971      if ( ! is_multisite() ) {
972
973           /** This filter is documented in wp-includes/option.php */
974           $default = apply_filters( 'default_site_option_' . $option, $default );
975           $value = get_option($option, $default);
976      } else {
977           $cache_key = "{$wpdb->siteid}:$option";
978           if ( $use_cache )
979                $value = wp_cache_get($cache_key, 'site-options');
980
981           if ( !isset($value) || (false === $value) ) {
982                $row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
983
 
Line Code
985                if ( is_object( $row ) ) {
986                     $value = $row->meta_value;
987                     $value = maybe_unserialize( $value );
988                     wp_cache_set( $cache_key, $value, 'site-options' );
989                } else {
990                     $notoptions[$option] = true;
991                     wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
992
993                     /** This filter is documented in wp-includes/option.php */
994                     $value = apply_filters( 'default_site_option_' . $option, $default );
995                }
996           }
997      }
998
999      /**
1000       * Filter the value of an existing site option.
1001       *
1002       * The dynamic portion of the hook name, $option, refers to the option name.
1003       *