Title: allow_empty_comment
Published: February 22, 2019
Last modified: February 24, 2026

---

# apply_filters( ‘allow_empty_comment’, bool $allow_empty_comment, array $commentdata )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#wp--skip-link--target)

Filters whether an empty comment should be allowed.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#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()](https://developer.wordpress.org/reference/functions/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](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/comment.php#L3796)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3796-L3796)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Comments_Controller::check_is_comment_content_allowed()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/functions/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()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/wp_newcomment/)`wp-includes/class-wp-xmlrpc-server.php` |

Creates a new comment.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/allow_empty_comment/?output_format=md#comment-content-3177)
 2.   [rabmalin](https://profiles.wordpress.org/rabmalin/)  [  7 years ago  ](https://developer.wordpress.org/reference/hooks/allow_empty_comment/#comment-3177)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallow_empty_comment%2F%23comment-3177)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallow_empty_comment%2F%23comment-3177)
 4.     ```php
        // Enable empty comment.
        add_filter( 'allow_empty_comment', '__return_true' );
        ```
    
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallow_empty_comment%2F%3Freplytocom%3D3177%23feedback-editor-3177)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallow_empty_comment%2F)
before being able to contribute a note or feedback.