Filters whether comments can be created via the REST API without authentication.
$allow_anonymousbool$requestWP_REST_Requestwp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:476WP_REST_Comments_Controller::create_item_permissions_check() * * @param bool $allow_anonymous Whether to allow anonymous comments to * be created. Default `false`. * @param WP_REST_Request $request Request used to generate the * response. */ $allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request ); if ( ! $allow_anonymous ) { return new WP_Error( 'rest_comment_login_required', __( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 )Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.