notify_post_author

Filters whether to send the post author new comment notification emails, overriding the site setting.

Description

apply_filters( 'notify_post_author', (bool) $maybe_notify, (int) $comment_id ); 

Parameters (2)

0. $maybe_notify (bool)
Whether to notify the post author about the new comment.
1. $comment_id (int)
The ID of the comment for the notification.

Usage

To run the hook, copy the example below.
  1. $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_id ); 
  2.  
  3. if ( !empty( $maybe_notify ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the notify_post_author callback 
  2. function filter_notify_post_author( $maybe_notify, $comment_id ) { 
  3. // make filter magic happen here... 
  4. return $maybe_notify
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'notify_post_author', 'filter_notify_post_author', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'notify_post_author', 'filter_notify_post_author', 10, 2 ); 

Defined (1)

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

/wp-includes/comment.php  
  1. $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID );