allow_empty_comment хук-фильтрWP 5.1.0

Filters whether an empty comment should be allowed.

Использование

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.
По умолчанию: false
$commentdata(массив)
Array of comment data to be sent to wp_insert_comment().

Список изменений

С версии 5.1.0 Введена.

Где вызывается хук

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 );

Где используется хук в WordPress

Использование не найдено.