wp_new_comment_notify_moderator

Send a comment moderation notification to the comment moderator.

Description

wp_new_comment_notify_moderator( (int) $comment_ID ); 

Parameters (1)

0. $comment_id (int)
ID of the comment.

Usage

  1. if ( !function_exists( 'wp_new_comment_notify_moderator' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment.php'; 
  3.  
  4. // ID of the comment. 
  5. $comment_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_new_comment_notify_moderator($comment_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment.php  
  1. function wp_new_comment_notify_moderator( $comment_ID ) { 
  2. $comment = get_comment( $comment_ID ); 
  3.  
  4. // Only send notifications for pending comments. 
  5. $maybe_notify = ( '0' == $comment->comment_approved ); 
  6.  
  7. /** This filter is documented in wp-includes/comment.php */ 
  8. $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID ); 
  9.  
  10. if ( ! $maybe_notify ) { 
  11. return false; 
  12.  
  13. return wp_notify_moderator( $comment_ID );