comment_form_fields
Filter HookDescription
Filters the comment form fields, including the textarea.Hook Information
File Location |
wp-includes/comment-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2789 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$comment_fields
|
The comment fields. |
Usage Examples
Basic Usage
<?php
// Hook into comment_form_fields
add_filter('comment_form_fields', 'my_custom_filter', 10, 1);
function my_custom_filter($comment_fields) {
// Your custom filtering logic here
return $comment_fields;
}
Source Code Context
wp-includes/comment-template.php:2789
- How this hook is used in WordPress core
<?php
2784 *
2785 * @since 4.4.0
2786 *
2787 * @param array $comment_fields The comment fields.
2788 */
2789 $comment_fields = apply_filters( 'comment_form_fields', $comment_fields );
2790
2791 // Get an array of field names, excluding the textarea.
2792 $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) );
2793
2794 // Get the first and the last field name, excluding the textarea.
PHP Documentation
<?php
/**
* Filters the comment form fields, including the textarea.
*
* @since 4.4.0
*
* @param array $comment_fields The 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.