Custom Registration page – prevent redirect to wp-login.php?action=register

I already have a custom login from built with the following code:

add_action('login_redirect', 'jwh_redirect_login', 10, 3);
function jwh_redirect_login($redirect_to, $url, $user) {

$url = current(explode('?', $url));

    wp_redirect( $url . '?jwh_error=nopass');
else if($user->errors['empty_username']){
    wp_redirect( $url . '?jwh_error=nouser');
else if($user->errors['incorrect_password']){
    wp_redirect( $url . '?jwh_error=invalidpass');
else if($user->errors['invalid_username']){
    wp_redirect( $url . '?jwh_error=invaliduser');
else if(!empty($user->data)){
    wp_redirect( $url);
    wp_redirect($url . '?jwh_error="nothing');


Works great. User stays in place no matter the error or successful login. Now for the registration part. Problem there is if there is a registration error of any kind, the use is redirected to Is there a similiar hook I can use to site-url/wp-login.php?action=register

Is there a hook similar to login_redirect but for registration?


Leave a Comment