Protect custom content type from not logged in users
/* Only-logged-in-users */
function hcc_stop_guests( $content ) {
global $post;
if ( $post->post_type == 'YOUR_CUSTOM_POSTTYPE' ) {
if ( !is_user_logged_in() ) {
$content = 'Please login to view this post';
}
}
return $content;
}
add_filter( 'the_content', 'hcc_stop_guests' );