diff --git a/src/wp-includes/option.php b/src/wp-includes/option.php
index 13f5d49c87..ee52f3d969 100644
|
a
|
b
|
function update_option( $option, $value, $autoload = null ) {
|
| 755 | 755 | $value = clone $value; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | | $value = sanitize_option( $option, $value ); |
| 759 | | $old_value = get_option( $option ); |
| | 758 | $value = sanitize_option( $option, $value ); |
| | 759 | $old_value = get_option( $option ); |
| | 760 | $notoptions = wp_cache_get( 'notoptions', 'options' ); |
| | 761 | if ( ! is_array( $notoptions ) ) { |
| | 762 | $notoptions = array(); |
| | 763 | } |
| | 764 | if ( isset( $notoptions[ $option ] ) ) { |
| | 765 | $is_new_option = true; |
| | 766 | } else { |
| | 767 | $is_new_option = false; |
| | 768 | } |
| 760 | 769 | |
| 761 | 770 | /** |
| 762 | 771 | * Filters a specific option before its value is (maybe) serialized and updated. |
| … |
… |
function update_option( $option, $value, $autoload = null ) {
|
| 783 | 792 | */ |
| 784 | 793 | $value = apply_filters( 'pre_update_option', $value, $option, $old_value ); |
| 785 | 794 | |
| | 795 | if ( $is_new_option ) { |
| | 796 | // Default setting for new options is 'yes'. |
| | 797 | if ( null === $autoload ) { |
| | 798 | $autoload = 'yes'; |
| | 799 | } |
| | 800 | |
| | 801 | return add_option( $option, $value, '', $autoload ); |
| | 802 | } |
| | 803 | |
| 786 | 804 | /* |
| 787 | 805 | * If the new and old values are the same, no need to update. |
| 788 | 806 | * |
| … |
… |
function update_option( $option, $value, $autoload = null ) {
|
| 796 | 814 | return false; |
| 797 | 815 | } |
| 798 | 816 | |
| 799 | | /** This filter is documented in wp-includes/option.php */ |
| 800 | | if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) { |
| 801 | | // Default setting for new options is 'yes'. |
| 802 | | if ( null === $autoload ) { |
| 803 | | $autoload = 'yes'; |
| 804 | | } |
| 805 | | |
| 806 | | return add_option( $option, $value, '', $autoload ); |
| 807 | | } |
| 808 | | |
| 809 | 817 | $serialized_value = maybe_serialize( $value ); |
| 810 | 818 | |
| 811 | 819 | /** |
| … |
… |
function update_option( $option, $value, $autoload = null ) {
|
| 832 | 840 | return false; |
| 833 | 841 | } |
| 834 | 842 | |
| | 843 | // Yes, again... it needs to be fresh. |
| 835 | 844 | $notoptions = wp_cache_get( 'notoptions', 'options' ); |
| 836 | 845 | |
| 837 | 846 | if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { |