I have a question about the login form of the user registration add-on.
Can I change/correct the error message?
Do you mean the errors displayed when the wrong username or password are entered? If so, those errors are returned by WordPress, not by the add-on, so you would need to approach the change from WordPress side of things.
Thank you for contacting us.
Added the following to functions.php:
It works for WordPress login forms.
It doesn’t work for Gravity Forms login forms.
what am i doing wrong?
→ functions.php
function custom_login_errors( $errors, $redirect_to ) {
if( isset( $errors->errors[ 'invalid_email' ] ) ){
$errors->remove( 'invalid_email' );
$errors->add( 'invalid_email', 'This is an error.' );
}
if( isset( $errors->errors[ 'invalid_username' ] ) ){
$errors->remove( 'invalid_username' );
$errors->add( 'invalid_username', 'This is an error.' );
}
if( isset( $errors->errors[ 'incorrect_password' ] ) ){
$errors->remove( 'incorrect_password' );
$errors->add( 'incorrect_password', 'This is an error.' );
}
if( isset( $errors->errors[ 'empty_username' ] ) ){
$errors->remove( 'empty_username' );
$errors->add( 'empty_username', 'This is an error.' );
}
if( isset( $errors->errors[ 'empty_password' ] ) ){
$errors->remove( 'empty_password' );
$errors->add( 'empty_password', 'This is an error.' );
}
if( isset( $errors->errors[ 'confirm' ] ) ){
$errors->remove( 'confirm' );
$errors->add( 'confirm', 'This is an error.', 'message' );
}
return $errors;
}
add_filter( 'wp_login_errors', 'custom_login_errors', 10, 2 );