rest_prepare_widget_type filter-hookWP 5.8.0

Filters the REST API response for a widget type.

Usage

add_filter( 'rest_prepare_widget_type', 'wp_kama_rest_prepare_widget_type_filter', 10, 3 );

/**
 * Function for `rest_prepare_widget_type` filter-hook.
 * 
 * @param WP_REST_Response $response    The response object.
 * @param array            $widget_type The array of widget data.
 * @param WP_REST_Request  $request     The request object.
 *
 * @return WP_REST_Response
 */
function wp_kama_rest_prepare_widget_type_filter( $response, $widget_type, $request ){

	// filter...
	return $response;
}
$response(WP_REST_Response)
The response object.
$widget_type(array)
The array of widget data.
$request(WP_REST_Request)
The request object.

Changelog

Since 5.8.0 Introduced.

Where the hook is called

WP_REST_Widget_Types_Controller::prepare_item_for_response()
rest_prepare_widget_type
wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php 352
return apply_filters( 'rest_prepare_widget_type', $response, $widget_type, $request );

Where the hook is used in WordPress

Usage not found.