Title: Comment gets stuck at https://randomwpsite.com/wp-comments-post.php
Last modified: April 27, 2019

---

# Comment gets stuck at https://randomwpsite.com/wp-comments-post.php

 *  Resolved [viratraaz](https://wordpress.org/support/users/viratraaz/)
 * (@viratraaz)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/)
 * After looking everything, I found that:
    there is a function called wp_new_comment(
   $commentdata, $avoid_die = false ) in site_directory/wp-includes/comment.php 
   where do_action( ‘comment_post’, $comment_ID, $commentdata[‘comment_approved’],
   $commentdata ); is not working. I want to know where this function is defined
   and where the file is included? According to my analysis ‘do_action’ function
   is being called from site_directory/wp-includes/plugin.php but I don’t see enough
   arguments in the defined function.
 * Please help.
 * {temporary solution: comment line
    do_action( ‘comment_post’, $comment_ID, $commentdata[‘
   comment_approved’], $commentdata ); which is in wp_new_comment( $commentdata,
   $avoid_die = false ) function from file site_directory/wp-includes/comment.php}

Viewing 6 replies - 16 through 21 (of 21 total)

[←](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/?output_format=md)
[1](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/?output_format=md)
2

 *  Thread Starter [viratraaz](https://wordpress.org/support/users/viratraaz/)
 * (@viratraaz)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/page/2/#post-11472839)
 * **first:**
    I download fresh wordpress 5.1.1 from [https://wordpress.org/download/](https://wordpress.org/download/)
   I compared code from file site_directory/wp-comments-post.php , site_directory/
   wp-includes/comment.php and site_directory/wp-includes/plugin.php I found no 
   difference in code.
 * **Second:**
    I installed and activated WordFence. Then I ran scan and I found
   no issue [https://ibb.co/mrj3GPh](https://ibb.co/mrj3GPh)
 *  Thread Starter [viratraaz](https://wordpress.org/support/users/viratraaz/)
 * (@viratraaz)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/page/2/#post-11472853)
 * Please download fresh copy of wordpress 5.1.1 from [https://wordpress.org/download/](https://wordpress.org/download/)
   
   and install it. Then look for the file
 * > site_directory/wp-includes/comment.php
 * Search for
 * > function wp_new_comment(
 * You’ll see a function is defined with the name
 * > wp_new_comment( $commentdata, $avoid_die = false )
 * at the last second line of this function, you’ll find a function being called
 * > do_action( ‘comment_post’, $comment_ID, $commentdata[‘comment_approved’], $
   > commentdata );
 * Please tell me the use of this function (do_action) here
    -  This reply was modified 7 years, 1 month ago by [viratraaz](https://wordpress.org/support/users/viratraaz/).
 *  [Davood Denavi](https://wordpress.org/support/users/binarywc/)
 * (@binarywc)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/page/2/#post-11472987)
 * Please see the suggestions from [@shamim51](https://wordpress.org/support/users/shamim51/)
   and [@otto42](https://wordpress.org/support/users/otto42/)
    The search feature
   in my favorite text editor was broken and I did not realize it until after doing
   more digging. Sorry, but I am at a loss since your scan came back clean I think
   it is best if look at suggestions from others. Thank you for understanding and
   best of luck finding a fix.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/page/2/#post-11473235)
 * > Please tell me the use of this function (do_action) here
 * The do_action call is an “action hook”. By itself, it does nothing at all. It
   provides a point for functions from elsewhere in the code to hook in and do things
   at that point in the processing.
 * Like I said, the do_action is not your real problem. You have some other code
   using that hook, probably in a plugin, and that is your real problem. You need
   to deactivate your plugins in order to find out where the problem lies.
 *  Thread Starter [viratraaz](https://wordpress.org/support/users/viratraaz/)
 * (@viratraaz)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/page/2/#post-11474771)
 * Thanks [@otto42](https://wordpress.org/support/users/otto42/) I found solution.
   I also learnt many wordpress core functions now.
 * Although it took 2 days to solve it. But the solution is very easy.
 * Final Solution:
 * Step 1: Change your theme for few moments, (choose any light theme).
    Step 2:
   Disable all installed plugins. Step 3: Activate back your desired theme and plugins.
   Step 4: Install a fresh wordpress in your local machine. Step 6: Copy _local\
   _directory/wp-includes/class-phpmailer.php_ and _local\_directory/wp-includes/
   class-smtp.php_ Step 7: Paste this file here: _site\_directory/wp-includes/_ (
   replace both files if these are already there)
 * Solution close
 * _[ Contact URL removed, keep support in these forums ]_
 * Reason for this bug: Some plugins or themes create it’s own PHPmailer and delete
   some files conaining PHPmailer. After uninstlling or deactivating them, required
   PHPmailer get disappear and it start creating many errors.
 * Explanations: During debugging process, I found that in site_directory/wp-includes/
   pluggable.php, wp_mail function is defined. $phpmailer variable is globally called.
   after calling this variable, it checks for if it has PHPmailer instance. If $
   phpmailer was not defined properly earlier, it includes _site\_directory/wp-includes/
   class-phpmailer.php_ and _site\_directory/wp-includes/class-smtp.php_ . But I
   found that _site\_directory/wp-includes/class-phpmailer.php_ is unavailable. 
   I added this file and bug got fixed.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/page/2/#post-11475135)
 * > Reason for this bug: Some plugins or themes create it’s own PHPmailer and delete
   > some files conaining PHPmailer. After uninstlling or deactivating them, required
   > PHPmailer get disappear and it start creating many errors.
 * No theme or plugin should ever modify the WordPress core files.
 * If they do, please tell us what theme or plugin they are, and we will have words
   with them.

Viewing 6 replies - 16 through 21 (of 21 total)

[←](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/?output_format=md)
[1](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/?output_format=md)
2

The topic ‘Comment gets stuck at https://randomwpsite.com/wp-comments-post.php’ 
is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 21 replies
 * 4 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/comment-gets-stuck-at-https-randomwpsite-com-wp-comments-post-php/page/2/#post-11475135)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
