August 15, 2015 at 5:49 pm
#14462
Syam Mohan
Keymaster
Hi Bratt,
The reason it was not working because its too late to redirect from a page template.
function login_page_template_redirect() { if(is_page('login')) { if(is_user_logged_in()) { wp_redirect(apply_filters('login_redirect', '/')); } else { wp_redirect('/wp-login.php'); } exit(); } } add_action( 'template_redirect', 'login_page_template_redirect' );
Try putting the above code within the functions.php.
Thanks
Syam