WordPress.org

Make WordPress Core

Changeset 41673


Ignore:
Timestamp:
10/02/17 18:10:06 (7 weeks ago)
Author:
obenland
Message:

Widgets: Revert format of sidebars_widgets.

Restores the data format of the sidebars_widgets theme mod to its pre [41555]
format. It can trigger PHP warnings after switching themes if that mod has not
been removed previously.

Fixes #39693.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r41597 r41673  
    691691 
    692692    if ( is_array( $_sidebars_widgets ) ) { 
    693         set_theme_mod( 'sidebars_widgets', $_sidebars_widgets ); 
     693        set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $_sidebars_widgets ) ); 
    694694    } 
    695695 
  • trunk/src/wp-includes/widgets.php

    r41594 r41673  
    12871287    // Sidebars_widgets settings from when this theme was previously active. 
    12881288    $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' ); 
     1289    $old_sidebars_widgets = $old_sidebars_widgets['data']; 
    12891290 
    12901291    if ( is_array( $old_sidebars_widgets ) ) { 
  • trunk/tests/phpunit/tests/widgets.php

    r41594 r41673  
    714714        // Test restoring sidebars widgets when previously activated. 
    715715        set_theme_mod( 'sidebars_widgets', array( 
    716             'sidebar-1' => array( 'tag_cloud-1' ), 
    717             'sidebar-2' => array(), 
    718             'sidebar-3' => array( 'unregistered_widget-1', 'text-1', 'media_image-1' ), 
    719             'orphaned_widgets_1' => array( 'media_video-2' ), 
     716            'time' => time(), 
     717            'data' => array( 
     718                'sidebar-1' => array( 'tag_cloud-1' ), 
     719                'sidebar-2' => array(), 
     720                'sidebar-3' => array( 'unregistered_widget-1', 'text-1', 'media_image-1' ), 
     721                'orphaned_widgets_1' => array( 'media_video-2' ), 
     722            ), 
    720723        ) ); 
    721724 
Note: See TracChangeset for help on using the changeset viewer.