Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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;
}
?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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