Filters whether an empty comment should be allowed.
$allow_empty_commentbool$commentdataarraywp-includes/class-wp-xmlrpc-server.php:4019wp_xmlrpc_server::wp_newComment()wp-includes/comment.php:3796wp_handle_comment_submission()wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:2021WP_REST_Comments_Controller::check_is_comment_content_allowed() * * @since 5.1.0 * * @param bool $allow_empty_comment Whether to allow empty comments. Default false. * @param array $commentdata Array of comment data to be sent to wp_insert_comment(). */ $allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata ); if ( '' === $comment_content && ! $allow_empty_comment ) { return new WP_Error( 'require_valid_comment', __( '<strong>Error:</strong> Please type your comment text.' ), 200 ); } $check_max_lengths = wp_check_comment_data_max_lengths( $commentdata ); if ( is_wp_error( $check_max_lengths ) ) {Introduced in 5.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.