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