wp_new_comment_notify_moderator

函式
wp_new_comment_notify_moderator ( $comment_ID )
引數
  • (int) $comment_ID ID of the comment.
    Required:
返回值
  • (bool) True on success, false on failure.
定義位置
相關方法
wp_new_comment_notify_postauthorwp_notify_moderatorwp_new_commentwp_get_comment_statuswp_new_blog_notification
引入
4.4.0
棄用
-

wp_new_comment_notify_moderator: 這個鉤子用於在有新的評論被新增並需要稽覈時向網站管理員傳送電子郵件通知。它可以用來修改電子郵件資訊或新增額外的收件人。

向評論版主傳送評論稽覈通知。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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/comment.php */
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID );
if ( ! $maybe_notify ) {
return false;
}
return wp_notify_moderator( $comment_ID );
}
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/comment.php */ $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID ); if ( ! $maybe_notify ) { return false; } return wp_notify_moderator( $comment_ID ); }
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/comment.php */
	$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID );

	if ( ! $maybe_notify ) {
		return false;
	}

	return wp_notify_moderator( $comment_ID );
}

常見問題

FAQs
檢視更多 >