Make WordPress Core

Opened 7 months ago

Last modified 4 months ago

#41683 new defect (bug)

Add Widget REST API endpoint

Reported by: spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: needs-patch needs-unit-tests
Focuses: rest-api Cc:


There needs to be a REST endpoint to interacts with widgets. Current users can use the options api to interact with the data, but this is extremely limited. I would recommend that we look to WP CLI for pointer on how the api is laid out. Docs can be found here - https://developer.wordpress.org/cli/commands/widget/ .

One of the likely issues with if the is a view, how the html for a widget is rendered.

Change History (3)

#2 @wonderboymusic
7 months ago

getting a widget by itself may be useful for admin screens, but to build a front end, you actually need access to Sidebars. See something I am using here: https://highforthis.com/wp-json/graphql/v1/sidebars

Without the sidebar context and a representation of the widget HTML, how useful is the data?

#3 @joehoyle
4 months ago

We have the repo https://github.com/WP-API/wp-api-menus-widgets-endpoints for adding this as a feature plugin, so I don't think we need to manage and do this in trac.

Note: See TracTickets for help on using tickets.