I have added a login form to a page template using wp_login_form(). This page template is used for a welcome/login page for an online seminar. When the user logs in I want them to be redirected to the online seminar page. Here is the code I used:
if (is_user_logged_in()) {
echo '<div class="logout"> <p>Hello!<div class="logout_user"> You are logged in and can proceed to the <a href="http://example.com/seminar">Online Seminar</a>.</div></p><br /><p><a id="wp-submit" class="logout" href="', wp_logout_url(), '" title="Logout">Logout</a></p></div>';
} else {
wp_login_form($args);
$args = array(
'echo' => true,
'redirect' => site_url('/seminar'),
'label_log_in' => __( 'Log in' ),
'form_id' => 'seminar-login',
'label_username' => __( 'Username' ),
'label_password' => __( 'Password' ),
'label_remember' => __( 'Remember Me' ),
'id_username' => 'user_login',
'id_password' => 'user_pass',
'id_submit' => 'wp-submit',
'remember' => true,
'value_username' => NULL,
'value_remember' => true
);
}
When I set it up yesterday it seemed to be redirecting just fine, but today it just stays on the welcome/login page. I read that this is the default action, so it seems to be ignoring the redirect. I tried using an absolute url:
'redirect' => 'http://example.com/seminar',
But, that didn't work either.
I've tried to think what might be affecting this (ie. plugin conflicts) and two things might be relevant. I use AIOWPSecurity to rename the login page and access to the seminar itself is controlled by the Groups plugin. But, that doesn't explain why it was working when I set it up yesterday, but not working now.
Does anyone have any ideas why the redirect doesn't work?
Thank You!
site_url( '/seminar/ ' )
will produce an absolute URL.