rest_prepare_plugin
Filter HookDescription
Filters plugin data for a REST API response.Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php
View on GitHub
|
Hook Type | Filter |
Line Number | 619 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_REST_Response
|
$response
|
The response object. |
array
|
$item
|
The plugin item from {@see get_plugin_data()}. |
WP_REST_Request
|
$request
|
The request object. |
Usage Examples
Basic Usage
<?php
// Hook into rest_prepare_plugin
add_filter('rest_prepare_plugin', 'my_custom_filter', 10, 3);
function my_custom_filter($response, $item, $request) {
// Your custom filtering logic here
return $response;
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php:619
- How this hook is used in WordPress core
<?php
614 *
615 * @param WP_REST_Response $response The response object.
616 * @param array $item The plugin item from {@see get_plugin_data()}.
617 * @param WP_REST_Request $request The request object.
618 */
619 return apply_filters( 'rest_prepare_plugin', $response, $item, $request );
620 }
621
622 /**
623 * Prepares links for the request.
624 *
PHP Documentation
<?php
/**
* Filters plugin data for a REST API response.
*
* @since 5.5.0
*
* @param WP_REST_Response $response The response object.
* @param array $item The plugin item from {@see get_plugin_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-plugins-controller.php
Related Hooks
Related hooks will be displayed here in future updates.