rest_prepare_plugin filter-hookWP 5.5.0

Filters plugin data for a REST API response.

Usage

add_filter( 'rest_prepare_plugin', 'wp_kama_rest_prepare_plugin_filter', 10, 3 );

/**
 * Function for `rest_prepare_plugin` filter-hook.
 * 
 * @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.
 *
 * @return WP_REST_Response
 */
function wp_kama_rest_prepare_plugin_filter( $response, $item, $request ){

	// filter...
	return $response;
}
$response(WP_REST_Response)
The response object.
$item(array)
The plugin item from {@see get_plugin_data()}.
$request(WP_REST_Request)
The request object.

Changelog

Since 5.5.0 Introduced.

Where the hook is called

WP_REST_Plugins_Controller::prepare_item_for_response()
rest_prepare_plugin
wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php 614
return apply_filters( 'rest_prepare_plugin', $response, $item, $request );

Where the hook is used in WordPress

Usage not found.