admin管理员组

文章数量:1332403

I have a customer post type called video. I want wordpress to send an email notification to one user who is going to check and approve the comments, when ever someone comments on that post type video.

Please help me how to set it up.

Below code is not working and also custom post type is missing

//Custom notification
function se_comment_moderation_recipients( $emails, $comment_id ) {
    $comment = get_comment( $comment_id );
    $post = get_post( $comment->comment_post_ID );
    $user = get_user_by( 'id', '615895' );

    // Return only the post author if the author can modify.
    if ( user_can( $user->ID, 'edit_published_posts' ) && ! empty( $user->user_email ) ) {
        $emails = array( $user->user_email );
    }

    return $emails;
}
add_filter( 'comment_moderation_recipients', 'se_comment_moderation_recipients', 11, 2 );
add_filter( 'comment_notification_recipients', 'se_comment_moderation_recipients', 11, 2 );

本文标签: Email notification to an email address other than admin for custom type post comments in wordpress