How to redirect to home_url() if user is not logged in
What’s the best way to redirect to the home_url() if the user is not logged in? I’m using WP 3.3.1 and BP 126.96.36.199.
I tried adding a function, that contained bp_core_redirect(), to get_header, i.e. add_action(‘get_header’, ‘my_function’);. But that gives me this warning: Cannot modify header information – headers already sent by (output started at /home/livinghm/public_html/wp-content/themes/gratitude/groups/index.php:12) in /home/livinghm/public_html/wp-includes/pluggable.php on line 866.
Using the plugin BuddyPress Private Community gives me an error as well.
Help is much appreciated. Thank you, Tonya
- The topic ‘How to redirect to home_url() if user is not logged in’ is closed to new replies.