I have a custom page template that looks like this:
<?php if( is_user_logged_in() ): ?>
<?php get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php thinkup_input_nav( 'nav-below' ); ?>
<?php thinkup_input_allowcomments(); ?>
<?php endwhile; wp_reset_query(); ?>
<?php get_footer(); ?>
<?php else:
wp_die('Sorry, you must first <a href="/wp-login.php">log in</a> to view this page. You can <a href="/wp-login.php?action=register">register free here</a>.');
endif; ?>
Now, when I browse to the page that uses this page template, I'm asked to login. After the login, I'm redirected to the Wordpress admin panel. Browsing manually to the page only shows the same login again.
- How can I ensure that is_user_logged_in() detects that I'm logged in; and
- That I'm redirected to the page itself.
Thanks!