Filter hook 'pre_user_email'

in WP Core File wp-includes/user.php at line 2310

View Source

pre_user_email

Filter Hook
Description
Filters a user's email before the user is created or updated.

Hook Information

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

Hook Parameters

Type Name Description
string $raw_user_email The user's email.

Usage Examples

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

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

Source Code Context

wp-includes/user.php:2310 - How this hook is used in WordPress core
<?php
2305  	 *
2306  	 * @since 2.0.3
2307  	 *
2308  	 * @param string $raw_user_email The user's email.
2309  	 */
2310  	$user_email = apply_filters( 'pre_user_email', $raw_user_email );
2311  
2312  	/*
2313  	 * If there is no update, just check for `email_exists`. If there is an update,
2314  	 * check if current email and new email are the same, and check `email_exists`
2315  	 * accordingly.

PHP Documentation

<?php
/**
	 * Filters a user's email before the user is created or updated.
	 *
	 * @since 2.0.3
	 *
	 * @param string $raw_user_email The user's email.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.