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