[wp-trac] [WordPress Trac] #28093: Add REST API endpoints for widgets and sidebars

WordPress Trac noreply at wordpress.org
Thu Nov 16 20:48:13 UTC 2017

#28093: Add REST API endpoints for widgets and sidebars
 Reporter:  westonruter  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Widgets      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:  javascript, rest-api

Comment (by wonderboymusic):

 Blocks (to me) seem like a UI concept divorced from the notion of core
 models. Blocks seem like an interface containing types, options,
 reference(s), and content (also known as a parsed Shortcode).

 Widgets currently have a crappy interface (data, not UI), but those
 details could be hidden so the interface survives a migration.

 interface SidebarInterface {
   public function get_options(): array;
   public function get_widgets(): array<Widget>;

 interface WidgetInterface {
   public function get_options(): array;

 class Widget implements WidgetInterface {
   // existing bad fields that may change
   private $a;
   private $b;
   private $c;
   private $d;

   public function get_options() {
     return [...whatever from wherever...];

 I think we could create a "legacy" `wp/v2` endpoint and then bump the
 version to `wp/v3` for what Gutenberg wants to berth using the same

Ticket URL: <https://core.trac.wordpress.org/ticket/28093#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list