Make WordPress Core

Ticket #54677: 54677.patch

File 54677.patch, 1.3 KB (added by mvraghavan, 3 years ago)

Created patch

  • src/wp-includes/class-wp-widget.php

    diff --git a/src/wp-includes/class-wp-widget.php b/src/wp-includes/class-wp-widget.php
    index e91f5cd9f9..965b52dbad 100644
    a b class WP_Widget { 
    597597         */
    598598        public function save_settings( $settings ) {
    599599                $settings['_multiwidget'] = 1;
    600                 update_option( $this->option_name, $settings );
     600
     601                if ( isset( $this->alt_option_name ) ) {
     602                        update_option( $this->alt_option_name, $settings );
     603                } else {
     604                        update_option( $this->option_name, $settings );
     605                }
    601606        }
    602607
    603608        /**
    class WP_Widget { 
    609614         */
    610615        public function get_settings() {
    611616
    612                 $settings = get_option( $this->option_name );
     617                $settings = array();
    613618
     619                if ( isset( $this->alt_option_name ) ) {
     620                        $settings = get_option( $this->alt_option_name );
     621                } else {
     622                        $settings = get_option( $this->option_name );
     623                }
     624               
    614625                if ( false === $settings ) {
    615                         if ( isset( $this->alt_option_name ) ) {
    616                                 $settings = get_option( $this->alt_option_name );
    617                         } else {
    618                                 // Save an option so it can be autoloaded next time.
    619                                 $this->save_settings( array() );
    620                         }
     626                        // Save an option so it can be autoloaded next time.
     627                        $this->save_settings( array() );
    621628                }
    622629
    623630                if ( ! is_array( $settings ) && ! ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) ) {