Filter hook 'comment_notification_notify_author'

in WP Core File wp-includes/pluggable.php at line 1713

View Source

comment_notification_notify_author

Filter Hook
Description
Filters whether to notify comment authors of their comments on their own posts. By default, comment authors aren't notified of their comments on their own posts. This filter allows you to override that.

Hook Information

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

Hook Parameters

Type Name Description
bool $notify Whether to notify the post author of their own comment. Default false.
string $comment_id The comment ID as a numeric string.

Usage Examples

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

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

Source Code Context

wp-includes/pluggable.php:1713 - How this hook is used in WordPress core
<?php
1708  		 *
1709  		 * @param bool   $notify     Whether to notify the post author of their own comment.
1710  		 *                           Default false.
1711  		 * @param string $comment_id The comment ID as a numeric string.
1712  		 */
1713  		$notify_author = apply_filters( 'comment_notification_notify_author', false, $comment->comment_ID );
1714  
1715  		// The comment was left by the author.
1716  		if ( $author && ! $notify_author && (int) $comment->user_id === (int) $post->post_author ) {
1717  			unset( $emails[ $author->user_email ] );
1718  		}

PHP Documentation

<?php
/**
		 * Filters whether to notify comment authors of their comments on their own posts.
		 *
		 * By default, comment authors aren't notified of their comments on their own
		 * posts. This filter allows you to override that.
		 *
		 * @since 3.8.0
		 *
		 * @param bool   $notify     Whether to notify the post author of their own comment.
		 *                           Default false.
		 * @param string $comment_id The comment ID as a numeric string.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.