WordPress filter hook · part of WordPress core

comment_form_default_fields

A WordPress core filter that 16 plugins also fire themselves, running on 85K+ sites between them.

“Filter the default comment form fields.”

How to use comment_form_default_fields

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'comment_form_default_fields', function( $fields ) {
	// Change $fields here.
	return $fields;
}, 10, 1 );

Argument names come from Master Addons for Elementor's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

16 plugins that fire comment_form_default_fields

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Master Addons for Elementor icon Master Addons for Elementor30,000+ installs apply_filters( 'comment_form_default_fields', $fields ) addons/content/ma-comments/ma-comments.php:2272
  2. Post Grid Blocks & Templates for News, Magazine, & Blog Sites icon Post Grid Blocks & Templates for News, Magazine, & Blog Sites30,000+ installs apply_filters( 'comment_form_default_fields', array( 'author' => '<div class="ultp-field-control ultp-comment-name">' . wp_kses_post( $auth_label ) . '<input id="author" placeholder="Your name" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></div>', 'email' => '<div class="ultp-field-control ultp-comment-email">' . wp_kses_post( $email_label ) . '<input id="email" placeholder... ) addons/builder/blocks/Post_Comments.php:117
  3. Live Composer icon Live Composer10,000+ installs apply_filters( 'comment_form_default_fields', array( 'author' => '<div class="comment-form-name"><input id="author" name="author" type=text value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" placeholder="' . $txt_name . ' *" aria-required="true" /></div>', 'email' => '<div class="comment-form-email"><input id="email" name="email" type=text value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" placeholder=... ) modules/tp-comments-form/module.php:3373
  4. BP Classic icon BP Classic6,000+ installs apply_filters( 'comment_form_default_fields', $fields ) themes/bp-default/functions.php:667
  5. Sliced Invoices icon Sliced Invoices4,000+ installs apply_filters( 'comment_form_default_fields', array( 'author' => '', 'email' => '', 'url' => '' ) ) public/class-sliced-public.php:439
  6. WPMobile.App icon WPMobile.App3,000+ installs apply_filters( 'comment_form_default_fields', $fields ) themes/wpappninja/comments.php:115
  7. The Pack Elementor addon icon The Pack Elementor addon2,000+ installs apply_filters( 'comment_form_default_fields', [ 'author' => '<div class="comment-form-author khbcomment-field"><input id="author" class="form-control" name="author" type="text" value="' . $commenter['comment_author'] . '" placeholder="' . $settings['name'] . '"/></div>', 'email' => '<div class="comment-form-email khbcomment-field"><input id="email" name="email" class="form-control" type="text" value="' . $commenter['comment_author_email'] ... ) includes/widgets/theme/post_comment/view.php:16
  8. WP Mobile X icon WP Mobile X100+ installs apply_filters( 'comment_form_default_fields', $fields ) themes/mobx-default/comments.php:59
  9. Educat Elementor LMS Addon icon Educat Elementor LMS Addon20+ installs apply_filters( 'comment_form_default_fields', [ 'author' => '<div class="comment-form-author khbcomment-field"><input id="author" class="form-control" name="author" type="text" value="' . $commenter['comment_author'] . '" placeholder="' . $settings['name'] . '"/></div>', 'email' => '<div class="comment-form-email khbcomment-field"><input id="email" name="email" class="form-control" type="text" value="' . $commenter['comment_author_email'] ... ) includes/widgets/element/post_comment/view.php:14
  10. Give Me Answer Lite icon Give Me Answer Lite10+ installs apply_filters( 'comment_form_default_fields', $fields ) includes/class-template.php:284
  11. Comments Everywhere icon Comments Everywhere10+ installs apply_filters( 'comment_form_default_fields', $fields ) files/comment-template.php:28
  12. Oxford Debate icon Oxford Debate10+ installs apply_filters( 'comment_form_default_fields', array( 'author' => '<div>' . '<div>' . '<span id="basic-name">' . __('Your name','oxd') .'*</span>' . '<input id="author" name="author" type="text" class="form-control" aria-describedby="basic-name" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30">' . '</div>' . '</div>', 'email' => '<div>' . '<div>' . '<span id="basic-email">' . __('Your email','oxd') .'*</span>' . '<input id... ) templates/comments-debate.php:62
  13. SB Comment icon SB Comment10+ installs apply_filters( 'comment_form_default_fields', array( 'author' => '<p class="comment-form-author name">' . '<label for="author">' . __( 'Tên', 'sb-comment' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" placeholder="'.__('Họ và tên', 'sb-comment').' *" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" ' . $aria_req . ' class="sb-author-info"></p>', 'email' => '... ) inc/sb-plugin-functions.php:26
  14. Simple Ajax Insert Comments Lite icon Simple Ajax Insert Comments Lite10+ installs apply_filters( 'comment_form_default_fields', $fields ) inc/saic-functions.php:119
  15. WP Documentation Lite icon WP Documentation Lite10+ installs apply_filters( 'comment_form_default_fields', array( 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'wp-documentation-lite' ) .( $req ? '<span class="required">*</span>' : '' ) . '</label> ' . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" /> </p>', 'email' => '<p class="comment-form-email">' . '<label for="email">' . __( 'Email', 'wp-do... ) templates/comments-wp-documentation.php:74
  16. WP Forum icon WP Forum10+ installs apply_filters( 'comment_form_default_fields', $fields ) view/shortcode/wp-forum-inner.php:50

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.