Filter hook 'invited_user_email'

in WP Core File wp-admin/user-new.php at line 170

View Source

invited_user_email

Filter Hook
Description
Filters the contents of the email sent when an existing user is invited to join the site. }

Hook Information

File Location wp-admin/user-new.php View on GitHub
Hook Type Filter
Line Number 170

Hook Parameters

Type Name Description
array $new_user_email { Used to build wp_mail().
int $user_id The invited user's ID.
array $role Array containing role information for the invited user.
string $newuser_key The key of the invitation.

Usage Examples

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

function my_custom_filter($new_user_email, $user_id, $role, $newuser_key) {
    // Your custom filtering logic here
    return $new_user_email;
}

Source Code Context

wp-admin/user-new.php:170 - How this hook is used in WordPress core
<?php
 165  			 * @param int    $user_id     The invited user's ID.
 166  			 * @param array  $role        Array containing role information for the invited user.
 167  			 * @param string $newuser_key The key of the invitation.
 168  			 *
 169  			 */
 170  			$new_user_email = apply_filters( 'invited_user_email', $new_user_email, $user_id, $role, $newuser_key );
 171  
 172  			wp_mail(
 173  				$new_user_email['to'],
 174  				$new_user_email['subject'],
 175  				$new_user_email['message'],

PHP Documentation

<?php
/**
			 * Filters the contents of the email sent when an existing user is invited to join the site.
			 *
			 * @since 5.6.0
			 *
			 * @param array $new_user_email {
			 *     Used to build wp_mail().
			 *
			 *     @type string $to      The email address of the invited user.
			 *     @type string $subject The subject of the email.
			 *     @type string $message The content of the email.
			 *     @type string $headers Headers.
			 * }
			 * @param int    $user_id     The invited user's ID.
			 * @param array  $role        Array containing role information for the invited user.
			 * @param string $newuser_key The key of the invitation.
			 *
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-admin/user-new.php
Related Hooks

Related hooks will be displayed here in future updates.