woocommerce_new_customer_username
Filter new customer username.
Usage
add_filter( 'woocommerce_new_customer_username', 'wp_kama_woocommerce_new_customer_username_filter', 10, 4 );
/**
* Function for `woocommerce_new_customer_username` filter-hook.
*
* @param string $username Customer username.
* @param string $email New customer email address.
* @param array $new_user_args Array of new user args, maybe including first and last names.
* @param string $suffix Append string to username to make it unique.
*
* @return string
*/
function wp_kama_woocommerce_new_customer_username_filter( $username, $email, $new_user_args, $suffix ){
// filter...
return $username;
}
- $username(string)
- Customer username.
- $email(string)
- New customer email address.
- $new_user_args(array)
- Array of new user args, maybe including first and last names.
- $suffix(string)
- Append string to username to make it unique.
Changelog
| Since 3.7.0 | Introduced. |
Where the hook is called
woocommerce/includes/wc-user-functions.php 304
return apply_filters( 'woocommerce_new_customer_username', $username, $email, $new_user_args, $suffix );