Filter hook 'wp_mail_from_name'

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

View Source

wp_mail_from_name

Filter Hook
Description
Filters the name to associate with the "from" email address.

Hook Information

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

Hook Parameters

Type Name Description
string $from_name Name associated with the "from" email address.

Usage Examples

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

function my_custom_filter($from_name) {
    // Your custom filtering logic here
    return $from_name;
}

Source Code Context

wp-includes/pluggable.php:406 - How this hook is used in WordPress core
<?php
 401  		 *
 402  		 * @since 2.3.0
 403  		 *
 404  		 * @param string $from_name Name associated with the "from" email address.
 405  		 */
 406  		$from_name = apply_filters( 'wp_mail_from_name', $from_name );
 407  
 408  		try {
 409  			$phpmailer->setFrom( $from_email, $from_name, false );
 410  		} catch ( PHPMailer\PHPMailer\Exception $e ) {
 411  			$mail_error_data                             = compact( 'to', 'subject', 'message', 'headers', 'attachments' );

PHP Documentation

<?php
/**
		 * Filters the name to associate with the "from" email address.
		 *
		 * @since 2.3.0
		 *
		 * @param string $from_name Name associated with the "from" email address.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.