Home › Forums › Support › Login sidebar › Reply To: Login sidebar
April 14, 2015 at 9:40 am
#98493
Tom
Lead Developer
Lead Developer
Hmm, I would do something like this:
add_action('wp','generate_redirect_page');
function generate_redirect_page()
{
// Change page-slug to which page they land on
if ( is_page('page-slug') ) {
// If user is logged in
if ( is_user_logged_in() ) {
// Do nothing - allow access
} else {
// If they're not logged in, redirect them to yoursite.com/no-access
$redirect = site_url() . '/no-access';
wp_redirect( $redirect ); exit;
}
}
}
And I would add it using one of these methods: http://generatepress.com/knowledgebase/adding-php-functions/
Let me know 🙂