Filters whether an empty comment should be allowed.
Parameters
$allow_empty_comment
bool- Whether to allow empty comments. Default false.
$commentdata
array- 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_agent
stringThe HTTP user agent of the$comment_author
when the comment was submitted. Default empty.comment_approved
int|stringWhether the comment has been approved. Default 1.comment_author
stringThe name of the author of the comment. Default empty.comment_author_email
stringThe email address of the$comment_author
. Default empty.comment_author_IP
stringThe IP address of the$comment_author
. Default empty.comment_author_url
stringThe URL address of the$comment_author
. Default empty.comment_content
stringThe content of the comment. Default empty.comment_date
stringThe date the comment was submitted. To set the date manually,$comment_date_gmt
must also be specified.
Default is the current time.comment_date_gmt
stringThe date the comment was submitted in the GMT timezone.
Default is$comment_date
in the site’s GMT timezone.comment_karma
intThe karma of the comment. Default 0.comment_parent
intID of this comment’s parent, if any. Default 0.comment_post_ID
intID of the post that relates to the comment, if any.
Default 0.comment_type
stringComment type. Default'comment'
.comment_meta
arrayOptional. Array of key/value pairs to be stored in commentmeta for the new comment.user_id
intID 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