On this page
apply_filters( 'allow_empty_comment', bool $allow_empty_comment, array $commentdata )
Filters whether an empty comment should be allowed.
Parameters
$allow_empty_commentbool-
Whether to allow empty comments. Default false.
$commentdataarray-
Array of comment data to be sent to wp_insert_comment() .
More Arguments from wp_insert_comment( ... $commentdata )
Array of arguments for inserting a new comment.
comment_agentstringThe HTTP user agent of the$comment_authorwhen the comment was submitted. Default empty.comment_approvedint|stringWhether the comment has been approved. Default 1.comment_authorstringThe name of the author of the comment. Default empty.comment_author_emailstringThe email address of the$comment_author. Default empty.comment_author_IPstringThe IP address of the$comment_author. Default empty.comment_author_urlstringThe URL address of the$comment_author. Default empty.comment_contentstringThe content of the comment. Default empty.comment_datestringThe date the comment was submitted. To set the date manually,$comment_date_gmtmust also be specified.
Default is the current time.comment_date_gmtstringThe date the comment was submitted in the GMT timezone.
Default is$comment_datein the site's GMT timezone.comment_karmaintThe karma of the comment. Default 0.comment_parentintID of this comment's parent, if any. Default 0.comment_post_IDintID of the post that relates to the comment, if any.
Default 0.comment_typestringComment type. Default'comment'.comment_metaarrayOptional. Array of key/value pairs to be stored in commentmeta for the new comment.user_idintID of the user who submitted the comment. Default 0.
Source
File: wp-includes/comment.php. View all references
$allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
Related
Used By
| Used By | Description |
|---|---|
| WP_REST_Comments_Controller::check_is_comment_content_allowed() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | If empty comments are not allowed, checks if the provided comment content is not empty. |
| wp_handle_comment_submission() wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| wp_xmlrpc_server::wp_newComment() wp-includes/class-wp-xmlrpc-server.php | Create new comment. |
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/allow_empty_comment