WordPress at Your Fingertips
function is not described

WP_REST_Widget_Types_Controller::get_items() public WP 5.8.0

Retrieves the list of all widget types.

{} It's a method of the class: WP_REST_Widget_Types_Controller{}

No Hooks.


WP_REST_Response|WP_Error. Response object on success, or WP_Error object on failure.


$WP_REST_Widget_Types_Controller = new WP_REST_Widget_Types_Controller();
$WP_REST_Widget_Types_Controller->get_items( $request );
$request(WP_REST_Request) (required)
Full details about the request.


Since 5.8.0 Introduced.

Code of WP_REST_Widget_Types_Controller::get_items() WP 5.8.1

public function get_items( $request ) {
	$data = array();
	foreach ( $this->get_widgets() as $widget ) {
		$widget_type = $this->prepare_item_for_response( $widget, $request );
		$data[]      = $this->prepare_response_for_collection( $widget_type );

	return rest_ensure_response( $data );