Title: Changing comment fields to remove asterisks?
Last modified: February 11, 2020

---

# Changing comment fields to remove asterisks?

 *  Resolved [smellpress](https://wordpress.org/support/users/smellpress/)
 * (@smellpress)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/changing-comment-fields-to-remove-asterisks/)
 * I have made the name and email fields optional in the WordPress settings, and
   would like to remove the asterisks from the fields because they give a misleading
   impression that the fields are required.
 * I have copied `comments.php` into my child theme and have successfully modified
   some aspects of it, but cannot manage to change `placeholder="Name *"` and `placeholder
   ="Email *"`, even when when wrapping `comment_form($args)` in `str_replace()`!
   Attempting to replace the HTML with `$fields['author'] = "myMarkupHere"` ceases
   to do anything, though I can use that for fictional fields – a possible workaround?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Theme Author [Tom](https://wordpress.org/support/users/edge22/)
 * (@edge22)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/changing-comment-fields-to-remove-asterisks/#post-12422826)
 * Hi there,
 * You shouldn’t need to overwrite `comments.php`.
 * Instead, add this function:
 *     ```
       add_filter( 'comment_form_default_fields', function( $fields ) {
           $commenter = wp_get_current_commenter();
   
           $fields['author'] = sprintf(
               '<label for="author" class="screen-reader-text">%1$s</label><input placeholder="%1$s" id="author" name="author" type="text" value="%2$s" size="30" />',
               esc_html__( 'Name', 'generatepress' ),
               esc_attr( $commenter['comment_author'] )
           );
   
           $fields['email'] = sprintf(
               '<label for="email" class="screen-reader-text">%1$s</label><input placeholder="%1$s" id="email" name="email" type="email" value="%2$s" size="30" />',
               esc_html__( 'Email', 'generatepress' ),
               esc_attr( $commenter['comment_author_email'] )
           );
   
           return $fields;
       }, 20 );
       ```
   
 *  Thread Starter [smellpress](https://wordpress.org/support/users/smellpress/)
 * (@smellpress)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/changing-comment-fields-to-remove-asterisks/#post-12423766)
 * Cheers, it works!
    -  This reply was modified 6 years, 3 months ago by [smellpress](https://wordpress.org/support/users/smellpress/).
 *  Theme Author [Tom](https://wordpress.org/support/users/edge22/)
 * (@edge22)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/changing-comment-fields-to-remove-asterisks/#post-12424032)
 * Glad I could help! 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Changing comment fields to remove asterisks?’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/generatepress/3.6.1/screenshot.
   png)
 * GeneratePress
 * [Support Threads](https://wordpress.org/support/theme/generatepress/)
 * [Active Topics](https://wordpress.org/support/theme/generatepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/generatepress/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/generatepress/reviews/)

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)

 * 3 replies
 * 2 participants
 * Last reply from: [Tom](https://wordpress.org/support/users/edge22/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/changing-comment-fields-to-remove-asterisks/#post-12424032)
 * Status: resolved