Filter hook 'comment_form_default_fields'

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

View Source

comment_form_default_fields

Filter Hook
Description
Filters the default comment form fields.

Hook Information

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

Hook Parameters

Type Name Description
string[] $fields Array of the default comment fields.

Usage Examples

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

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

Source Code Context

wp-includes/comment-template.php:2607 - How this hook is used in WordPress core
<?php
2602  	 *
2603  	 * @since 3.0.0
2604  	 *
2605  	 * @param string[] $fields Array of the default comment fields.
2606  	 */
2607  	$fields = apply_filters( 'comment_form_default_fields', $fields );
2608  
2609  	$defaults = array(
2610  		'fields'               => $fields,
2611  		'comment_field'        => sprintf(
2612  			'<p class="comment-form-comment">%s %s</p>',

PHP Documentation

<?php
/**
	 * Filters the default comment form fields.
	 *
	 * @since 3.0.0
	 *
	 * @param string[] $fields Array of the default comment fields.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.