Title: Comment Form Modifications
Last modified: February 24, 2019

---

# Comment Form Modifications

 *  Resolved [myeternaltrails](https://wordpress.org/support/users/myeternaltrails/)
 * (@myeternaltrails)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/comment-form-modifications/)
 * Hi Textbook Community,
 * I am trying to Make only NAME field Mandatory in my comment section of the posts.
   And somehow I managed to do that by adding following piece of code in my functions.
   php file
 *     ```
       function require_comment_name($fields) {
       if ($fields['comment_author'] == '')
       wp_die('Error: please enter a valid name.');
       return $fields;
       }
       add_filter('preprocess_comment', 'require_comment_name');
       ```
   
 * But there are two problems which I am not able to resolve :-
 * 1- The Validation Result is shown after Posting the comment. While I want it 
   to happen in such a way that I should not be able to Post comment without filling
   the NAME field (similar to COMMENT text area)
    2- I should be able to show “Required”
   Text in the Name Field Area.
 * Any help in this will be much appreciated !
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcomment-form-modifications%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Velda](https://wordpress.org/support/users/supernovia/)
 * (@supernovia)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/comment-form-modifications/#post-11274522)
 * Hi [@myeternaltrails](https://wordpress.org/support/users/myeternaltrails/), 
   did you make any progress on this? I understand you want to make the name, but
   not the email address, required?
 * I wanted to note that the comment form is standard through WordPress. If you 
   make changes via a plugin or functionality snippet rather than through your theme,
   the changes can persist even if you use a different theme.
 * Noting as well, if you do choose to modify the theme, be sure to use a child 
   theme rather than editing your theme directly.
 *  Thread Starter [myeternaltrails](https://wordpress.org/support/users/myeternaltrails/)
 * (@myeternaltrails)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-form-modifications/#post-11478005)
 * Hi [@supernovia](https://wordpress.org/support/users/supernovia/), No I couldn’t
   proceed further on this problem.
 * Yes, I am doing these changes using a Child Theme, but problem is, these modifications
   are not giving the results which I actually want.
 * Also, with reference to make these changes via a plugin or functionality snippet,
   do you have any clue on this which can solve my problem ?
 *  [Gemma Evans](https://wordpress.org/support/users/gemmaevans/)
 * (@gemmaevans)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-form-modifications/#post-11503816)
 * Hi [@myeternaltrails](https://wordpress.org/support/users/myeternaltrails/),
 * > do you have any clue on this which can solve my problem ?
 * I’m unable to say which whether a custom function or plugin will be the better
   option is this will very much depend on the site setup and your level of coding
   knowledge.
 * If the function above isn’t working, you may want to contact a developer for 
   help — they should be able to take a closer look at what is happening. [Jetpack.pro](https://jetpack.pro/)
   is a great place to look for developers if you don’t already know someone.
 *  Thread Starter [myeternaltrails](https://wordpress.org/support/users/myeternaltrails/)
 * (@myeternaltrails)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-form-modifications/#post-11507326)
 * Hi [@gemmaevans](https://wordpress.org/support/users/gemmaevans/) ,
 * Thanks for your suggestion. I’ll surely do that.
 *  [Gemma Evans](https://wordpress.org/support/users/gemmaevans/)
 * (@gemmaevans)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-form-modifications/#post-11508745)
 * You’re very welcome, best of luck 🙂

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

The topic ‘Comment Form Modifications’ is closed to new replies.

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

## Tags

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

 * 5 replies
 * 3 participants
 * Last reply from: [Gemma Evans](https://wordpress.org/support/users/gemmaevans/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/comment-form-modifications/#post-11508745)
 * Status: resolved