Filter hook 'comment_form_field_{$name}'

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

View Source

comment_form_field_{$name}

Filter Hook
Description
Filters a comment form field for display. The dynamic portion of the hook name, `$name`, refers to the name of the comment form field. Possible hook names include: - `comment_form_field_comment` - `comment_form_field_author` - `comment_form_field_email` - `comment_form_field_url` - `comment_form_field_cookies`

Hook Information

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

Hook Parameters

Type Name Description
string $field The HTML-formatted output of the comment form field.

Usage Examples

Basic Usage
<?php
// Hook into comment_form_field_{$name}
add_filter('comment_form_field_{$name}', 'my_custom_filter', 10, 1);

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

Source Code Context

wp-includes/comment-template.php:2842 - How this hook is used in WordPress core
<?php
2837  					 *
2838  					 * @since 3.0.0
2839  					 *
2840  					 * @param string $field The HTML-formatted output of the comment form field.
2841  					 */
2842  					echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
2843  
2844  					if ( $last_field === $name ) {
2845  						/**
2846  						 * Fires after the comment fields in the comment form, excluding the textarea.
2847  						 *

PHP Documentation

<?php
/**
					 * Filters a comment form field for display.
					 *
					 * The dynamic portion of the hook name, `$name`, refers to the name
					 * of the comment form field.
					 *
					 * Possible hook names include:
					 *
					 *  - `comment_form_field_comment`
					 *  - `comment_form_field_author`
					 *  - `comment_form_field_email`
					 *  - `comment_form_field_url`
					 *  - `comment_form_field_cookies`
					 *
					 * @since 3.0.0
					 *
					 * @param string $field The HTML-formatted output of the comment form field.
					 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.