Thank you for reading,

In the admin panel, when a comment is awaiting moderation, you can "Approve and Reply" in the same action.

However, in the front end, if you show the awaiting comments to the admin, and she hits Reply, the comment wont approve.

Does anybody know how to get the proper link, or where modify the code, to auto-approve comments when the admin replies ?

Why: I'm creating the site for a client, and trying to make it as easy as posible so she won't need to learn WP's admin panel.

1 Answer 1


Well... All you have to do is to check what hooks are available during comment posting.

The one I think might be helpful is wp_insert_comment. So you could do something like this:

function my_wp_insert_comment($id, $comment) {
    if ( is_admin() && $comment->comment_parent ) {
        if ( wp_get_comment_status( $comment->comment_parent ) == 'unapproved' )
            wp_set_comment_status( $comment->comment_parent, 'approve' );
add_action('wp_insert_comment', 'my_wp_insert_comment', 10, 2);

Just place this code in function.php file of your theme. This function will be called every time a comment is inserted into database. No matter how (from admin area, front end or by some plugin, etc.)

  • Hey! Thanks for the reply. What's the "10, 2" at the last line?
    – bysanchy
    Jun 21, 2013 at 15:11
  • 1
    @sanchy the first is the priority of the callback (higher = later) and the second specifies the number of arguments passed to it. Jun 27, 2013 at 12:31
  • @StephenHarris Thank you! OK, I tried this solution and works perfect. Thank you Krzysiek!
    – bysanchy
    Jun 27, 2013 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.