wp_new_comment_notify_moderator( int $comment_id ): bool

In this article

Sends a comment moderation notification to the comment moderator.

Parameters

$comment_idintrequired
ID of the comment.

Return

bool True on success, false on failure.

Source

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 );
}

Hooks

apply_filters( ‘notify_moderator’, bool $maybe_notify, int $comment_id )

Filters whether to send the site moderator email notifications, overriding the site setting.

Changelog

VersionDescription
4.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.