1

Any user that is not an admin is not being redirected to the defined URL with an instance of wp_login_form().

$args = array(
    'echo' => true,
    'redirect' => site_url( '/chat/' ), 
    'form_id' => 'loginform',
    'label_username' => __( 'Username' ),
    'label_password' => __( 'Password' ),
    'label_remember' => __( 'Remember Me' ),
    'label_log_in' => __( 'Log In' ),
    'id_username' => 'user_login',
    'id_password' => 'user_pass',
    'id_remember' => 'rememberme',
    'id_submit' => 'wp-submit',
    'remember' => true,
    'value_username' => NULL,
    'value_remember' => false );


wp_login_form( $args );

When I log in as an admin, it works fine. When I use a test subscriber or editor account, it redirects to the home page.

1 Answer 1

1

It should work, I use the login_redirect filter to achive what you want. There is a good example on the page, taking different logged in user roles into account. Check it out.

1
  • Just found it. Issue was a plugin conflict with Pie Register. Looked over login_redirect filter. Looks handy. I assume Pie Register is using this somewhere in their plugin. They have a redirect after registration setting, tried changing that and issue persisted. Do you need to flush the filters like you do with permalink rules? Commented Nov 1, 2013 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.