-
bp-help replied to the topic Redirect if not logged in and not on register page in the forum Creating & Extending 10 years, 2 months ago
@0901091-1
Not sure if this is exactly what you need and I didn’t test it but you can try it out:
<?php
function my_redirecter() {
if ( !is_user_logged_in() && !is_home() )
{
wp_redirect( home_url() );
exit();
}
else
{
}
}
add_action( 'init', 'my_redirecter' );
?>
-
bp-help replied to the topic Redirect if not logged in and not on register page in the forum Creating & Extending 10 years, 2 months ago
@0901091-1
Untested but you can try this:
<?php
function my_redirecter() {
if ( ! is_user_logged_in() && !bp_is_register_page() )
{
wp_redirect( home_url() . '/register/');
exit();
}
else
{
}
}
add_action( 'init', 'my_redirecter' );
?>
Not sure what you wanted to do with the else so I left it…
@0901091-1
Active 10 years, 2 months ago