Opened 2 years ago
Last modified 4 months ago
#16613 new enhancement
Extend Widget API to allow sidebar/widget manipulation
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | Awaiting Review |
| Component: | Widgets | Version: | 3.1 |
| Severity: | normal | Keywords: | needs-patch dev-feedback 2nd-opinion needs-codex |
| Cc: | scribu, sirzooro, dcowgill@…, chacha102 |
Description
There is currently no easy way to add a widget to a sidebar using code. We should add methods of doing this.
A good example usage of such an API could be when a new theme is activated, it could add it's custom widgets to it's sidebar.
API should provide support for adding widget X to sidebar Y (or even just the first sidebar) along with setting some options for the widget and where in the sidebar to add it (top vs. bottom).
Change History (6)
comment:3
in reply to:
↑ 2
Viper007Bond — 2 years ago
Replying to ryan:
Trying to decide if I would deactivate on the spot any theme that did this. ;-)
Ha, okay, maybe not the greatest example, but I have legitimate usage for this API. :P
- Cc sirzooro added
- Keywords dev-feedback 2nd-opinion needs-codex added
+1 for this.
I am going to create custom wizard-like plugin, which will allow to quickly configure new site. It will perform following tasks:
- gather few configuration details from user;
- activate plugins and configure them;
- set theme;
- add widgets and configure them.
So far it looks that last step will be the most difficult, because Widgets Management API is mostly undocumented, and some operations are even available via admin-ajax.php only.
If is is possible, please document at least some operations on Codex now. For code changes it is probably too late to include them in 3.3, so please target them for 3.4. It will be good to change this ticket to Blessed Task for 3.4.

Trying to decide if I would deactivate on the spot any theme that did this. ;-)