allow_empty_comment
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 | Введена. |
Где вызывается хук
allow_empty_comment
allow_empty_comment
wp-includes/comment.php 3733
$allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
wp-includes/class-wp-xmlrpc-server.php 4019
$allow_empty = apply_filters( 'allow_empty_comment', false, $comment );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1919
$allow_empty = apply_filters( 'allow_empty_comment', false, $check );