Notify Admin When someone add Review on Woocommerce Product?
-
As the question states I want to send notification to admin of website (wordpress) when someone add Review to the website, I searched about It and find two code snippet attached below:
1:
function new_comment_moderation_recipients( $emails, $comment_id ) { return array( ‘[email protected]’ ); } add_filter( ‘comment_moderation_recipients’, ‘new_comment_moderation_recipients’, 24, 2 ); add_filter( ‘comment_notification_recipients’, ‘new_comment_moderation_recipients’, 24, 2 );
And 2:
public static function comment_moderation_recipients( $emails, $comment_id ) {
$comment = get_comment( $comment_id );
if ( $comment && ‘product’ === get_post_type( $comment->comment_post_ID ) ) {
$emails = array( get_option( ‘admin_email’ ) );
}
return $emails; }The first one I added to “function.php”, but not work for me. And for the Second(2nd) Code snippet when I add It, My website is facing a syntax error.
Can you please help me out with this?
Thanks in advance.
- The topic ‘Notify Admin When someone add Review on Woocommerce Product?’ is closed to new replies.