Changeset 35100
- Timestamp:
- 10/13/2015 01:12:12 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-widget.php
r34782 r35100 540 540 $settings = get_option( $this->option_name ); 541 541 542 if ( false === $settings && isset( $this->alt_option_name ) ) { 543 $settings = get_option( $this->alt_option_name ); 542 if ( false === $settings ) { 543 if ( isset( $this->alt_option_name ) ) { 544 $settings = get_option( $this->alt_option_name ); 545 } else { 546 // Save an option so it can be autoloaded next time. 547 $this->save_settings( array() ); 548 } 544 549 } 545 550 -
trunk/tests/phpunit/tests/widgets.php
r34817 r35100 466 466 unset( $option_value['_multiwidget'] ); 467 467 468 // Pretend this widget is new. 469 delete_option( 'widget_nav_menu' ); 470 $never_used = get_option( 'widget_nav_menu' ); 471 $this->assertFalse( $never_used ); 472 468 473 wp_widgets_init(); 469 474 $wp_widget_search = $wp_registered_widgets['search-2']['callback'][0]; … … 476 481 $this->assertEquals( $settings[ $widget_number ], $option_value[ $widget_number ] ); 477 482 } 483 484 // After widgets_init(), get_settings() should create the widget option. 485 $never_used = get_option( 'widget_nav_menu' ); 486 $this->assertEquals( 1, $never_used['_multiwidget'] ); 487 $this->assertArrayNotHasKey( 0, $never_used ); 478 488 } 479 489
Note: See TracChangeset
for help on using the changeset viewer.