rest_prepare_widget_type
Filter HookDescription
Filters the REST API response for a widget type.Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
View on GitHub
|
Hook Type | Filter |
Line Number | 363 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_REST_Response
|
$response
|
The response object. |
array
|
$widget_type
|
The array of widget data. |
WP_REST_Request
|
$request
|
The request object. |
Usage Examples
Basic Usage
<?php
// Hook into rest_prepare_widget_type
add_filter('rest_prepare_widget_type', 'my_custom_filter', 10, 3);
function my_custom_filter($response, $widget_type, $request) {
// Your custom filtering logic here
return $response;
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php:363
- How this hook is used in WordPress core
<?php
358 *
359 * @param WP_REST_Response $response The response object.
360 * @param array $widget_type The array of widget data.
361 * @param WP_REST_Request $request The request object.
362 */
363 return apply_filters( 'rest_prepare_widget_type', $response, $widget_type, $request );
364 }
365
366 /**
367 * Prepares links for the widget type.
368 *
PHP Documentation
<?php
/**
* Filters the REST API response for a widget type.
*
* @since 5.8.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
Related Hooks
Related hooks will be displayed here in future updates.