comment_form_defaults хук-фильтрWP 3.0.0

Filters the comment form default arguments.

Use comment_form_default_fields to filter the comment fields.

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

add_filter( 'comment_form_defaults', 'wp_kama_comment_form_defaults_filter' );

/**
 * Function for `comment_form_defaults` filter-hook.
 * 
 * @param array $defaults The default comment form arguments.
 *
 * @return array
 */
function wp_kama_comment_form_defaults_filter( $defaults ){

	// filter...
	return $defaults;
}
$defaults(массив)
The default comment form arguments.

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

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

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

comment_form()
comment_form_defaults
wp-includes/comment-template.php 2516
$args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );

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

wp-includes/blocks/post-comments-form.php 32
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/blocks/post-comments-form.php 38
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/blocks/post-comments.php 85
add_filter( 'comment_form_defaults', 'post_comments_block_form_defaults' );