1

Is there a action similar to save_post for comments? Already tried comment_post which does not fire when clicking the update button on a comment in WordPress.

1

You can try the edit_comment hook that's fired within the wp_update_comment() function, called by the edit_comment() function when you edit a comment in the backend.

This hook is fired after the comment is updated in the database.

Example:

add_action( 'edit_comment', 
    function( $comment_ID )
    {
        // ... your code here ...
    }
);

Notice the following comment in the source:

The hook also fires immediately before comment status transition hooks are fired.

I find this comment somewhat confusing, because it's actually the get_comment filter that's fired immediately before the comment status transition hooks are fired within the wp_transition_comment_status() function. But it's true if hook = action, but I usually understand the meaning of the word hooks to be both actions and filters. But this was just a minor detour.

ps: My first thought/guess was save_comment, before I checked the source ;-)

0
0

I use simply this, as i couldnt find other..

add_action('plugins_loaded', 'Check_commentt');          //or directly execute Check_commentt()
function Check_commentt(){
    if (isset($_POST['author']) && isset($_POST['email'])){
        //do something
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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