Filter hook 'notify_post_author'

in WP Core File wp-includes/comment.php at line 2434

View Source

notify_post_author

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

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Filter
Line Number 2434

Hook Parameters

Type Name Description
bool $maybe_notify Whether to notify the post author about the new comment.
int $comment_id The ID of the comment for the notification.

Usage Examples

Basic Usage
<?php
// Hook into notify_post_author
add_filter('notify_post_author', 'my_custom_filter', 10, 2);

function my_custom_filter($maybe_notify, $comment_id) {
    // Your custom filtering logic here
    return $maybe_notify;
}

Source Code Context

wp-includes/comment.php:2434 - How this hook is used in WordPress core
<?php
2429  	 * @since 4.4.0
2430  	 *
2431  	 * @param bool $maybe_notify Whether to notify the post author about the new comment.
2432  	 * @param int  $comment_id   The ID of the comment for the notification.
2433  	 */
2434  	$maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_id );
2435  
2436  	/*
2437  	 * wp_notify_postauthor() checks if notifying the author of their own comment.
2438  	 * By default, it won't, but filters can override this.
2439  	 */

PHP Documentation

<?php
/**
	 * Filters whether to send the post author new comment notification emails,
	 * overriding the site setting.
	 *
	 * @since 4.4.0
	 *
	 * @param bool $maybe_notify Whether to notify the post author about the new comment.
	 * @param int  $comment_id   The ID of the comment for the notification.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.