allow_empty_comment filter-hookWP 5.1.0

Filters whether an empty comment should be allowed.

Usage

add_filter( 'allow_empty_comment', 'wp_kama_allow_empty_comment_filter', 10, 2 );

/**
 * Function for `allow_empty_comment` filter-hook.
 * 
 * @param bool  $allow_empty_comment Whether to allow empty comments.
 * @param array $commentdata         Array of comment data to be sent to wp_insert_comment().
 *
 * @return bool
 */
function wp_kama_allow_empty_comment_filter( $allow_empty_comment, $commentdata ){

	// filter...
	return $allow_empty_comment;
}
$allow_empty_comment(true|false)
Whether to allow empty comments.
Default: false
$commentdata(array)
Array of comment data to be sent to wp_insert_comment().

Changelog

Since 5.1.0 Introduced.

Where the hook is called

wp_handle_comment_submission()
allow_empty_comment
wp_xmlrpc_server::wp_newComment()
allow_empty_comment
WP_REST_Comments_Controller::check_is_comment_content_allowed()
allow_empty_comment
wp-includes/comment.php 3661
$allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
wp-includes/class-wp-xmlrpc-server.php 4007
$allow_empty = apply_filters( 'allow_empty_comment', false, $comment );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1903
$allow_empty = apply_filters( 'allow_empty_comment', false, $check );

Where the hook is used in WordPress

Usage not found.