Opened 8 years ago
Closed 8 years ago
#40067 closed enhancement (wontfix)
Add widgets settings to theme_mods option in database
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8 |
Component: | Widgets | Keywords: | |
Focuses: | Cc: |
Description
After a theme switch, only sidebars data is saved with widgets ids, but not widgets data is stored. I think widgets settings should be stored too because sometimes widgets settings can be lost on other themes so when you switch back to the old theme, all widgets can be gone.
You can test by yourself: after you will switch off a theme you will notice that old theme widgets are listed in the "Inactive Widgets" widget area, so if you click
"Clear Inactive Widgets" all widgets will get away forever, so when you will switch back to your old theme, no widgets will show.
Change History (6)
#2
follow-up:
↓ 3
@
8 years ago
@alexvorn2
after you will switch off a theme you will notice that old theme widgets are listed in the "Inactive Widgets" widget area, so if you click
is this not intended behavior? If it is not clear then the messaging should make it clear that the widgets in the Inactive Widgets area are both widgets that have been manually deactivated and also automatically deactivated due to theme switches, and that if they get removed then they will be deleted from the site.
Widget instances are not intrinsic to the theme. The sidebars are intrinsic to the theme. Copying widgets into theme mods will make the widget storage situation much worse than it already is (see #35669 for storing widgets in a custom post type instead of options).
#3
in reply to:
↑ 2
@
8 years ago
Replying to westonruter:
is this not intended behavior? If it is not clear then the messaging should make it clear that the widgets in the Inactive Widgets area are both widgets that have been manually deactivated and also automatically deactivated due to theme switches, and that if they get removed then they will be deleted from the site.
Maybe yes, but I think old approach is not good. If a sidebar was removed in the same theme, then all orphaned widgets will show in the Inactive Widgets sidebar, so why we need to show even more widgets from all other themes, so if you have one hundred themes and you switched all of them, then you will have maybe hundreds of widgets there, so it is not good.
We need a new model to make it all look nice in the end, right?
So storing widgets data in theme_mod_[theme_name] option is the best idea I can think of, so at the end after switching all your themes, manipulating a lot of sidebars and widgets options, in the end you will get what you will have to expect, the right number widgets you had in the sidebars, and not empty sidebars.
#4
follow-up:
↓ 5
@
8 years ago
@alexvorn2 but in your proposal won't widget areas always be empty when you switch to a new theme the first time? The key user need is to port widgets across themes. This doesn't seem to be accounted for in your proposal.
#5
in reply to:
↑ 4
@
8 years ago
Replying to westonruter:
@alexvorn2 but in your proposal won't widget areas always be empty when you switch to a new theme the first time? The key user need is to port widgets across themes. This doesn't seem to be accounted for in your proposal.
If you left an empty sidebar before a theme switch, then yes when you switch back to your old theme - you will see a empty sidebar, but if you switch it for the first time we can fill the first sidebar with default widgets.
But as the new trend here is to have custom widgets bundled with the theme like Twenty Seventeen, it makes sense that theme developers to do the same for their new themes.
Related: #39693