#40177 closed defect (bug) (duplicate)
sidebars_widgets option is not updated after activating a theme on Live Preview (on some themes)
| Reported by: | alexvorn2 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Customize | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Widgets are lost after theme activation on Live Preview, a very strange bug, it seems the sidebars_widgets option is not saved after you press Save & Activate button on Live Preview...
This bug can be replicated only doing the same steps as I did:
- Fresh Install
- Activate Twenty Fourteen theme
- Go to widgets.php
- Remove all widgets in the Primary Sidebar
- Add custom widget to Primary Sidebar (Calendar for example)
- Active Twenty Seventeen theme
- Now Live Preview our theme Twenty Fourteen
(you can see that we have the Calendar widget in the live preview)
- Click Save & Activate
- Go to widgets.php page and you can see that the Primary Sidebar is empty and our Calendar widget is as inactive widget
Expected to see the Calendar widget in Primary Sidebar
I hope you can replicate this...
Change History (5)
#2
in reply to: ↑ 1
@
9 years ago
Replying to westonruter:
I'm assuming this is going to be closely related to #39693.
The steps in this ticket will be great to codify in a test case.
Yes, I can share a code I created that can simulate that Twenty Fourteen theme had a Calendar widget in the sidebar-1 Sidebar before...
$template_my = 'twentyfourteen'; $theme_installed = get_option( $template_my . '_theme_installed', false ); if ( ! (bool) $theme_installed ) { $sidebars_widgets = array( 'wp_inactive_widgets' => array(), 'sidebar-1' => array( 'calendar-2' ), 'sidebar-2' => array(), 'sidebar-3' => array(), ); set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $sidebars_widgets ) ); $calendar_widget = array( '2' => array( 'title' => '' ), '_multiwidget' => 1 ); update_option( 'widget_calendar', $calendar_widget ); update_option( $template_my . '_theme_installed', true ); }
So you can add this code to functions.php file of the Twenty Fourteen theme.
To test this you need to:
- Go to themes page
- Click Live Preview for Twenty Fourteen theme (You will see the Calendar widget there in the sidebar)
- Click Save & Publish
- When you go after that to the widgets.php page the Calendar widget is not in the Sidebar anymore.
Expected to see it there :(
Hope this helps.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I'm assuming this is going to be closely related to #39693.
The steps in this ticket will be great to codify in a test case.