Filter hook 'comment_notification_headers'

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

View Source

comment_notification_headers

Filter Hook
Description
Filters the comment notification email headers.

Hook Information

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

Hook Parameters

Type Name Description
string $message_headers Headers for the comment notification email.
string $comment_id Comment ID as a numeric string.

Usage Examples

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

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

Source Code Context

wp-includes/pluggable.php:1778 - How this hook is used in WordPress core
<?php
1773  		 * @since 1.5.2
1774  		 *
1775  		 * @param string $message_headers Headers for the comment notification email.
1776  		 * @param string $comment_id      Comment ID as a numeric string.
1777  		 */
1778  		$message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID );
1779  
1780  		foreach ( $emails as $email ) {
1781  			$user = get_user_by( 'email', $email );
1782  
1783  			if ( $user ) {

PHP Documentation

<?php
/**
		 * Filters the comment notification email headers.
		 *
		 * @since 1.5.2
		 *
		 * @param string $message_headers Headers for the comment notification email.
		 * @param string $comment_id      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.