| 319 | 319 | * @param string $option Name of the option to update. |
| 320 | 320 | * @param mixed $old_value The old option value. |
| 321 | 321 | * @param mixed $value The new option value. |
| 322 | 322 | */ |
| 323 | 323 | do_action( 'update_option', $option, $old_value, $value ); |
| 324 | 324 | |
| 325 | 325 | $update_args = array( |
| 326 | 326 | 'option_value' => $serialized_value, |
| 327 | 327 | ); |
| 328 | 328 | |
| 329 | 329 | if ( null !== $autoload ) { |
| 330 | 330 | $update_args['autoload'] = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) ); |
| 336 | 338 | |
| 337 | 339 | $notoptions = wp_cache_get( 'notoptions', 'options' ); |
| 338 | 340 | if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { |
| 339 | 341 | unset( $notoptions[$option] ); |
| 340 | 342 | wp_cache_set( 'notoptions', $notoptions, 'options' ); |
| 341 | 343 | } |
| 342 | 344 | |
| 343 | 345 | if ( ! wp_installing() ) { |
| 344 | 346 | $alloptions = wp_load_alloptions(); |
| 345 | 347 | if ( isset( $alloptions[$option] ) ) { |
| 346 | 348 | $alloptions[ $option ] = $serialized_value; |
| 347 | 349 | wp_cache_set( 'alloptions', $alloptions, 'options' ); |
| 348 | 350 | } else { |
| 349 | 351 | wp_cache_set( $option, $serialized_value, 'options' ); |
| 350 | 352 | } |