Title: Comment button not working
Last modified: November 8, 2021

---

# Comment button not working

 *  [GEK0](https://wordpress.org/support/users/gek0/)
 * (@gek0)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/comment-button-not-working-3/)
 * Hello!
    I have a weird situation on one of my websites, in comment area section
   in blog. When you want to write a comment and when hitting “submit” button, the
   page goes back to top and in the link it gives me a “#” in the tail and the comment
   is not submited. I did not confronted again with this problem, can anyone help
   me? Thanks.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcomment-button-not-working-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [yogeshyadav20](https://wordpress.org/support/users/yogeshyadav20/)
 * (@yogeshyadav20)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/comment-button-not-working-3/#post-15046320)
 * Hi [@gek0](https://wordpress.org/support/users/gek0/)
 * it’s was working before?
 *     ```
       <?php $comments = get_comments( array('post_id'=>get_the_ID(),'status'=>'approve'));?>
       <div class="comments">
       	<h5><?php echo get_comments_number($post->ID); ?> Comments</h5>
       	<div class="navigation">
       	    <?php paginate_comments_links(); ?> 
       	</div>
       	<ul>
       	    <?php 
               if(count($comments)): 
               echo '<ol class="comment">';
               $comments = get_comments(array('post_id'=>$post->ID,'status'=>'approve'));
               wp_list_comments(array('per_page' =>-1,'reverse_top_level'=>false), $comments);
               echo '</ol>';
               else:
               ?>
               <p>There are no responses to this article, why not be the first? </p>
               <?php endif; ?>
       	</ul>
       	<div class="navigation">
       	    <?php paginate_comments_links(); ?> 
       	</div>
       	<div id="respond" class="comment-respond">
       	    <div class="row">
       	        <div class="col-md-8">
       	            <?php 
       				$commenter = wp_get_current_commenter();
       				$comments_args = array(
       					'label_submit'=>'Post Comment',
       					'title_reply'=>'Leave a Reply',
       					'comment_form_top' => 'ds',
       			        'comment_notes_before' => '',
       			        'format'            => 'xhtml',
       			        'comment_notes_after' => '',
       			        'class_submit' => 'submit btn btn-default',
       				    'fields' => apply_filters(
       				        'comment_form_default_fields', array(
       				            'author' =>'<div class="comment-form-author form-group mb-4">' . '<input id="author" placeholder="Name *" name="author" type="text" class="form-control" value="'.esc_attr($commenter['comment_author']) . '" required/>'.'</div>',
       				            'email'=>'<div class="comment-form-email form-group">' . '<input id="email" placeholder="Email *" name="email" type="text" class="form-control" value="'.esc_attr($commenter['comment_author_email']) .'" required/>' .'</div>',)
       				    ),
       				    'comment_field' => '<div class="comment-form-comment form-group mb-4">' .
       				        '<textarea class="form-control" id="comment" name="comment" placeholder="Comments *" required></textarea>' .
       				        '</div>',
       				    'comment_notes_after' => '',
       				);
       				comment_form($comments_args); ?>
       	        </div>
       	    </div>
       	</div>
       </div>
   
       // add the filter
       add_filter( 'comment_form_submit_button', 'filter_comment_form_submit_button', 10, 2 );
       ```
   
 * update your code like this
    -  This reply was modified 4 years, 7 months ago by [yogeshyadav20](https://wordpress.org/support/users/yogeshyadav20/).
 *  [yogeshyadav20](https://wordpress.org/support/users/yogeshyadav20/)
 * (@yogeshyadav20)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/comment-button-not-working-3/#post-15046349)
 * and call it’s like this
 *  <?php if(comments_open() || get_comments_number()) :comments_template(); endif;?
   >
 * above mention code will be comments.php file
 *  Thread Starter [GEK0](https://wordpress.org/support/users/gek0/)
 * (@gek0)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/comment-button-not-working-3/#post-15046399)
 * Thanks, Yogesh!

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

The topic ‘Comment button not working’ is closed to new replies.

## Tags

 * [button](https://wordpress.org/support/topic-tag/button/)
 * [not working](https://wordpress.org/support/topic-tag/not-working/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [GEK0](https://wordpress.org/support/users/gek0/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/comment-button-not-working-3/#post-15046399)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
