rest_comment_query
Filters WP_Comment_Query arguments when querying comments via the REST API.
Использование
add_filter( 'rest_comment_query', 'wp_kama_rest_comment_query_filter', 10, 2 ); /** * Function for `rest_comment_query` filter-hook. * * @param array $prepared_args Array of arguments for WP_Comment_Query. * @param WP_REST_Request $request The REST API request. * * @return array */ function wp_kama_rest_comment_query_filter( $prepared_args, $request ){ // filter... return $prepared_args; }
- $prepared_args(массив)
- Array of arguments for WP_Comment_Query.
- $request(WP_REST_Request)
- The REST API request.
Список изменений
С версии 4.7.0 | Введена. |
Где вызывается хук
rest_comment_query
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 275
$prepared_args = apply_filters( 'rest_comment_query', $prepared_args, $request );