Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wwtdev04

    (@wwtdev04)

    Yes, But in my case, Registration form url is Register and when form fails, it send to page Failed-Register

    Thread Starter wwtdev04

    (@wwtdev04)

    This code is under template_redirect function in class-theme-my-login.php

    case 'register' :
    					if ( ! get_option( 'users_can_register' ) ) {
    						$redirect_to = site_url( 'wp-login.php?registration=disabled' );
    						wp_redirect( $redirect_to );
    						exit;
    					}
    
    					$user_login = '';
    					$user_email = '';
    					if ( $http_post ) {
    						if ( 'email' == $this->get_option( 'login_type' ) ) {
    							$user_login = isset( $_POST['user_email'] ) ? $_POST['user_email'] : '';
    						} else {
    							$user_login = isset( $_POST['user_login'] ) ? $_POST['user_login'] : '';
    						}
    						$user_email = isset( $_POST['user_email'] ) ? $_POST['user_email'] : '';
    
    						$this->errors = register_new_user( $user_login, $user_email );
    
    						if ( ! is_wp_error( $this->errors ) ) {
    							$redirect_to = ! empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : site_url( 'wp-login.php?checkemail=registered' );
    							wp_safe_redirect( $redirect_to );
    							exit;
    						}
    					}
    					break;

    Here, $_POST[‘redirect_to’] = “mysite.com/wp-admin” but when i try and register with existing user’s email, then condition ! is_wp_error( $this->errors ) is false and it redirects to mysite.com/register where as I want it to redirect to mysite.com/user/login as I have “Registration” and “login” form on same page.

Viewing 2 replies - 1 through 2 (of 2 total)