I need to send 2 email messages: if comment was submitted and when comment was approved. Without any plugin of course. How can I do this?


For comment approved, you can review this question

Approve comment hook?

For comment submitted, you can hook into the comment_post hook, like

function show_message_function( $comment_ID, $comment_approved ) {
    if( 0 === $comment_approved ){
        //function logic goes here
add_action( 'comment_post', 'show_message_function', 10, 2 );

Code copied from https://developer.wordpress.org/reference/hooks/comment_post/

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.