Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: blog_option_{$setting}

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 2 times in this file.

Line Code
339                $notoptions = wp_cache_get( 'notoptions', 'options' );
340                if ( isset( $notoptions[$setting] ) ) {
341                     wp_cache_set( $key, 'noop', 'site-options' );
342                     $value = $default;
343                } elseif ( $value == false ) {
344                     wp_cache_set( $key, 'falsevalue', 'site-options' );
345                } else {
346                     wp_cache_set( $key, $value, 'site-options' );
347                }
348                return apply_filters( 'blog_option_' . $setting, $value, $blog_id );
349           } else {
350                $blog_prefix = $wpdb->get_blog_prefix( $blog_id );
351                $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$blog_prefix}options WHERE option_name = %s", $setting ) );
352                if ( is_object( $row ) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
353                     $value = $row->option_value;
354                     if ( $value == false )
355                          wp_cache_set( $key, 'falsevalue', 'site-options' );
356                     else
357                          wp_cache_set( $key, $value, 'site-options' );
 
Line Code
366           $value = false;
367      }
368      // If home is not set use siteurl.
369      if ( 'home' == $setting && '' == $value )
370           return get_blog_option( $blog_id, 'siteurl' );
371
372      if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
373           $value = untrailingslashit( $value );
374
375      return apply_filters( 'blog_option_' . $setting, maybe_unserialize( $value ), $blog_id );
376 }
377
378 /**
379  * Add an option for a particular blog.
380  *
381  * @since MU
382  *
383  * @param int $id The blog id
384  * @param string $key The option key