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_agent string
    The HTTP user agent of the $comment_author when the comment was submitted. Default empty.
  • comment_approved int|string
    Whether the comment has been approved. Default 1.
  • comment_author string
    The name of the author of the comment. Default empty.
  • comment_author_email string
    The email address of the $comment_author. Default empty.
  • comment_author_IP string
    The IP address of the $comment_author. Default empty.
  • comment_author_url string
    The URL address of the $comment_author. Default empty.
  • comment_content string
    The content of the comment. Default empty.
  • comment_date string
    The 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 string
    The date the comment was submitted in the GMT timezone.
    Default is $comment_date in the site’s GMT timezone.
  • comment_karma int
    The karma of the comment. Default 0.
  • comment_parent int
    ID of this comment’s parent, if any. Default 0.
  • comment_post_ID int
    ID of the post that relates to the comment, if any.
    Default 0.
  • comment_type string
    Comment type. Default 'comment'.
  • comment_meta array
    Optional. Array of key/value pairs to be stored in commentmeta for the new comment.
  • user_id int
    ID of the user who submitted the comment. Default 0.

Source

$allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );

Changelog

VersionDescription
5.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.