wp_new_comment_notify_moderator()WP 4.4.0

Sends a comment moderation notification to the comment moderator.

Hooks from the function

Return

true|false. True on success, false on failure.

Usage

wp_new_comment_notify_moderator( $comment_id );
$comment_id(int) (required)
ID of the comment.

Changelog

Since 4.4.0 Introduced.

wp_new_comment_notify_moderator() code WP 6.4.3

function wp_new_comment_notify_moderator( $comment_id ) {
	$comment = get_comment( $comment_id );

	// Only send notifications for pending comments.
	$maybe_notify = ( '0' == $comment->comment_approved );

	/** This filter is documented in wp-includes/pluggable.php */
	$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );

	if ( ! $maybe_notify ) {
		return false;
	}

	return wp_notify_moderator( $comment_id );
}