Wordpress 钩子:rest_pre_insert_comment
文章目录
在通过REST API插入注释之前过滤注释。
原型
apply_filters( 'rest_pre_insert_comment', array|WP_Error $prepared_comment, WP_REST_Request $request )
描述
允许在通过wp_insert_comment()插入注释之前修改注释。从过滤器返回WP_Error值将短路插入并允许跳过进一步处理。
参数
$prepared_comment
(array|WP_Error)
为wp_insert_comment()准备的注释数据。
$request
(WP_REST_Request)
用于插入评论的请求。
源文件
路径:wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
其他
英文文档:https://developer.wordpress.org/reference/hooks/rest_pre_insert_comment/
文章作者 iBllex
上次更新 2019-02-15