How to hide certain categories from 'not logged in users' in Wordpress blog? And redirect these 'not logged in users' to the login screen, and after login back to the post page?
All posts from that private category should be hidden (over the entire blog) for not logged in users. No messages, just completely not visible.
I tried to add this code to the funcions.php:
<?php
if ( is_user_logged_in() ) {
query_posts();
}
else{
query_posts( cat= -1 );
}
?>
But that shows a blank page on admin and front end.
Is there anybody who can help me how to do this? There should be a plugin for this, but there is none. Any help will be welcome. Thanks!
<?php if ( is_user_logged_in() ) { query_posts(); } else{ query_posts( cat='-1 ); } ?>For redirecting to login I use a plugin now. I first wanted to try to hide a certain category for non logged in users. - val