Filter hook 'comment_form_defaults'

in WP Core File wp-includes/comment-template.php at line 2681

View Source

comment_form_defaults

Filter Hook
Description
Filters the comment form default arguments. Use {@see 'comment_form_default_fields'} to filter the comment fields.

Hook Information

File Location wp-includes/comment-template.php View on GitHub
Hook Type Filter
Line Number 2681

Hook Parameters

Type Name Description
array $defaults The default comment form arguments.

Usage Examples

Basic Usage
<?php
// Hook into comment_form_defaults
add_filter('comment_form_defaults', 'my_custom_filter', 10, 1);

function my_custom_filter($defaults) {
    // Your custom filtering logic here
    return $defaults;
}

Source Code Context

wp-includes/comment-template.php:2681 - How this hook is used in WordPress core
<?php
2676  	 *
2677  	 * @since 3.0.0
2678  	 *
2679  	 * @param array $defaults The default comment form arguments.
2680  	 */
2681  	$args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
2682  
2683  	// Ensure that the filtered arguments contain all required default values.
2684  	$args = array_merge( $defaults, $args );
2685  
2686  	// Remove `aria-describedby` from the email field if there's no associated description.

PHP Documentation

<?php
/**
	 * Filters the comment form default arguments.
	 *
	 * Use {@see 'comment_form_default_fields'} to filter the comment fields.
	 *
	 * @since 3.0.0
	 *
	 * @param array $defaults The default comment form arguments.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.