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
1000            * Filter a specific default site option.
1001            *
1002            * The dynamic portion of the hook name, `$option`, refers to the option name.
1003            *
1004            * @since 3.4.0
1005            *
1006            * @param mixed $default The value to return if the site option does not exist
1007            *                       in the database.
1008            */
1009           return apply_filters( 'default_site_option_' . $option, $default );
1010      }
1011
1012      if ( ! is_multisite() ) {
1013
1014           /** This filter is documented in wp-includes/option.php */
1015           $default = apply_filters( 'default_site_option_' . $option, $default );
1016           $value = get_option($option, $default);
1017      } else {
1018           $cache_key = "{$wpdb->siteid}:$option";
1019           if ( $use_cache )
1020                $value = wp_cache_get($cache_key, 'site-options');
1021
1022           if ( !isset($value) || (false === $value) ) {
1023                $row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
1024
 
Line Code
1029                     wp_cache_set( $cache_key, $value, 'site-options' );
1030                } else {
1031                     if ( ! is_array( $notoptions ) ) {
1032                           $notoptions = array();
1033                     }
1034                     $notoptions[$option] = true;
1035                     wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1036
1037                     /** This filter is documented in wp-includes/option.php */
1038                     $value = apply_filters( 'default_site_option_' . $option, $default );
1039                }
1040           }
1041      }
1042
1043      /**
1044       * Filter the value of an existing site option.
1045       *
1046       * The dynamic portion of the hook name, `$option`, refers to the option name.
1047       *