apply_filters( 'user_registration_email', string $user_email )
Filters the email address of a user being registered.
Contents
Parameters
-
$user_email
string -
The email address of the new user.
More Information
This filter hooks into the very start of the register_new_user() function of wp-login.php after the user has been sanitized and it is used to manipulate the value submitted for user_email.
As it is the very first filter to be called in the registration process it’s a reasonable (i.e. not really good but possible) place to manipulate user registration data in $_POST as well as the email field itself before that data is further processed.
This means that it can be used for instance to set the email address field to be the same as the username (which on your registration form you could label as email address if you wanted to), and do other more interesting form customizations.
Source
File: wp-includes/user.php
.
View all references
$user_email = apply_filters( 'user_registration_email', $user_email );
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
An Example
Top ↑
Feedback
This overrides the registration email address entered and changes to the registration username. The intention is to use the registration email address as the username, but there does not appear to be a filter for that. Additionally,
register_new_user()
may be called without form submission, so the use of$_POST
would present problems in that context. — By crstauf —