rest_allow_anonymous_comments WordPress Filter Hook
The rest_allow_anonymous_comments hook is used to allow or disallow anonymous comments on a WordPress site. By default, WordPress does not allow anonymous comments, but this hook can be used to override that behavior.
apply_filters( 'rest_allow_anonymous_comments', bool $allow_anonymous , WP_REST_Request $request ) #
Filters whether comments can be created via the REST API without authentication.
Description
Enables creating comments for anonymous users.
Parameters
- $allow_anonymous
(bool)Whether to allow anonymous comments to be created. Default
false
.- $request
(WP_REST_Request)Request used to generate the response.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |