Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: update_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

Line Code
516      $notoptions = wp_cache_get( 'notoptions', 'options' );
517      if ( is_array( $notoptions ) && isset( $notoptions[$option_name] ) ) {
518           unset( $notoptions[$option_name] );
519           wp_cache_set( 'notoptions', $notoptions, 'options' );
520      }
521
522      $_newvalue = $newvalue;
523      $newvalue = maybe_serialize( $newvalue );
524
525      do_action( 'update_option', $option_name, $oldvalue, $newvalue );
526      $alloptions = wp_load_alloptions();
527      if ( isset( $alloptions[$option_name] ) ) {
528           $alloptions[$option_name] = $newvalue;
529           wp_cache_set( 'alloptions', $alloptions, 'options' );
530      } else {
531           wp_cache_set( $option_name, $newvalue, 'options' );
532      }
533
534      $wpdb->update($wpdb->options, array('option_value' => $newvalue), array('option_name' => $option_name) );