rest_prepare_post_type
apply_filters( ‘rest_prepare_post_type’, WP_REST_Response $response , WP_Post_Type $post_type , WP_REST_Request $request )
过滤器::过滤从API返回的post类型。
Filter Hook: Filters a post type returned from the API.
说明(Description)
允许在返回post类型数据之前对其进行修改。
参数(Parameters)
参数 | 类型 | 说明 |
---|---|---|
$response | (WP_REST_Response) | 响应对象。 |
$post_type | (WP_Post_Type) | 原始post类型对象。 |
$request | (WP_REST_Request) | 用于生成响应的请求。 |
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
4.7.0 | wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php:253 | 1 | 0 |
rest_prepare_post_type 为WP2原创文章,链接:https://www.wp2.cn/hook/rest_prepare_post_type/