Posting review REST API

This topic contains 16 replies, has 4 voices, and was last updated by  D.D 6 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #382043

    Kiran
    Moderator
    Post count: 7069

    Hi D.D

    Use following code snippet to get notification on comment via API.

    
    
    // Notify author on comment via API
    function gd_custom_new_comment_notify_postauthor( $comment, $request, $new = false ) {
        if ( $new && !empty( $comment->comment_ID ) ) {
            wp_new_comment_notify_postauthor( $comment->comment_ID );
        }
    }
    add_action( 'rest_insert_comment', 'gd_custom_new_comment_notify_postauthor', 10, 3 );

    But make sure you only get notification if:
    – Option enabled from Admin > Settings > Discussion
    – Comment author and listing author must be different

    Thanks,
    Kiran

    #382159

    D.D
    Buyer
    Post count: 199

    Works great now! thanks!

Viewing 2 posts - 16 through 17 (of 17 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket