#32987 closed enhancement (wontfix)
Adding filters to allow alternate sidebar storage for registered sidebars
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.3 |
| Component: | Widgets | Keywords: | has-patch dev-feedback bulk-reopened |
| Focuses: | Cc: |
Description
Currently sidebars are stored in the sidebars_widgets option in the database which for site with many sidebars can be very inefficient.
I would like to propose a means of being able to change how the information is stored.
I have introduced two filters that allow a user to have access to the information being saved or requested. This is backwards compatible but gives the option of using, for example ,a post type to store the data.
Attachments (6)
Change History (17)
#3
@
10 years ago
Some notes:
- These filter names need a little bit of work. They evaluate as booleans but the filter names don't really reflect that
- If we do end up keeping the boolean returns by default, the check on what is currently the 'sidebars_widgets_custom_storage' hook could just easily be a strict boolean check
On the hook docs:
- The duplicate hook comment should be one line, e.g.
/** This filter is documented in ... */ - The duplicate hook comment only needs to mention the path to the file
- Hook doc summaries should end with a period
@sinceversions should be the 3-digit x.x.x style, e.g. 4.4.0- Multiple types in phpDoc should use a pipe, e.g.
|
#4
follow-up:
↓ 5
@
10 years ago
@welcher As opposed to introducing new filters, why not just utilize pre_option_sidebars_widgets filters?
#5
in reply to:
↑ 4
@
10 years ago
Replying to westonruter:
@welcher As opposed to introducing new filters, why not just utilize
pre_option_sidebars_widgetsfilters?
Currently that would be the best approach, however I like the idea of having a hook before the get_option() call happens so we can decouple the get/set process completely from the calls to the *_option methods. I think this provides more flexibility moving forward.
I also found the storage process with the pre_update_option_sidebars_widgets filter to be a little counter-intuitive as you have to return $old_value to short circuit the update_option call.
.
@
10 years ago
Updated patch for better hook names, inline doc corrections and a more integrated approach to retrieving the widgets
This ticket was mentioned in Slack in #core by welcher. View the logs.
10 years ago
#8
@
10 years ago
I have added some unit tests as per the Slack discussion. Am happy to add more or make any further changes as needed.
Related #32470, #32474