I'm developing a Wordpress theme and I faced a problem while customizing a comment form. What I wanted is to eliminate URL field and put my own classes for name and email fields. I'm doing it like this:
$commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $fields = array( 'author' => '<p class="post-comment-name"><label for="post-comment-name">' . __( 'Name' ) . '</label><input type="text" id="post-comment-name" name="post-comment-name" placeholder="Write your name" value="' . esc_attr( $commenter['comment_author'] ) . '" ' . $aria_req . ' /></p>', 'email' => '<p class="post-comment-email"><label for="post-comment-email">' . __( 'Email' ) . '</label><input type="text" id="post-comment-email" name="post-comment-email" placeholder="Your email to reply" value="' . esc_attr( $commenter['comment_email'] ) . '" ' . $aria_req . ' /></p>', 'url' => '' ); $comments_args = array( 'title_reply' => '', 'comment_notes_before' => '', 'id_submit' => 'post-comment-submit', 'fields' => $fields ); comment_form($comments_args);
After all visually I've got what I wanted. I've got form with all the styles I wanted and with no URL field whatsoever.
The problem is when I try to submit the comment form with all the data filled in I get the message: "Fields name and email are required" and comment submission fails.
Tried almost everything, nothing helped. Please assist!