rest_allow_anonymous_comments хук-фильтр . WP 4.7.0
Filters whether comments can be created without authentication.
Enables creating comments for anonymous users.
Использование
add_filter( 'rest_allow_anonymous_comments', 'filter_function_name_9986', 10, 2 ); function filter_function_name_9986( $allow_anonymous, $request ){ // filter... return $allow_anonymous; }
- $allow_anonymous(true/false)
- Whether to allow anonymous comments to be created.
По умолчанию: false - $request(WP_REST_Request)
- Request used to generate the response.
Список изменений
С версии 4.7.0 | Введена. |
Где вызывается хук
rest_allow_anonymous_comments
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 463
$allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request );