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
$allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Introduced. |
User Contributed Notes