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.


Top ↑

Parameters

$allow_anonymous

(bool)Whether to allow anonymous comments to be created. Default false.

$request

(WP_REST_Request)Request used to generate the response.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.