0

I´m making a small wordpress/buddypress community site where I want all content except an about page to be for members only.

I need to do a redirect to the about-page for all non-logged in users. When users log in (from the sidebar) they should end up on the blog/frontpage.

How can I achive this? I tried some different members-plugins for buddypress and wordpress but none of them did exactly what I wanted, or didn´t work with other important plugins (like WP-FB-autoconnect).

I´m guessing this is pretty easy to do with custom code in the header or functions file. But I´m not really a coder so I would like som help!

0

Open your theme's headr.php file and add at the top

<?php
if( !is_user_logged_in() ) {
    wp_redirect(get_permalink(123));
    exit;
}
?>

just change 123 to the id of your about page, or replace get_permalink(123) with the about page URL example:

<?php
if( !is_user_logged_in() ) {
    wp_redirect('http://mydomain.com/about');
    exit;
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.