woocommerce_registration_errors
Filters registration errors before a customer account is registered.
This hook filters registration errors. This can be used to manipulate the array of errors before they are displayed.
Usage
add_filter( 'woocommerce_registration_errors', 'wp_kama_woocommerce_registration_errors_filter', 10, 3 );
/**
* Function for `woocommerce_registration_errors` filter-hook.
*
* @param \WP_Error $errors Error object.
* @param string $username Customer username.
* @param string $user_email Customer email address.
*
* @return \WP_Error
*/
function wp_kama_woocommerce_registration_errors_filter( $errors, $username, $user_email ){
// filter...
return $errors;
}
- $errors(\WP_Error)
- Error object.
- $username(string)
- Customer username.
- $user_email(string)
- Customer email address.
Changelog
| Since 7.2.0 | Introduced. |
Where the hook is called
woocommerce_registration_errors
woocommerce/includes/wc-user-functions.php 134
$errors = apply_filters( 'woocommerce_registration_errors', $errors, $username, $email );