The code recipe below sets membership restriction on a Custom Post Type (CPT) category. When a non-member visits a CPT in a protected category (either a logged out visitor or a logged in user without membership access) they will be redirected to the membership levels page (or another page as defined in your custom function).
How it Works
You can update the code recipe with appropriate membership levels to check, the CPT categories you want to redirect, and the page that the non-member gets redirected to. You can even duplicate the recipe to account for multiple CPT category and level/redirect page relationships.
Lets say, for example, you are using an events plugin. You could set a category of event for “Members Only”, then use this recipe to redirect non-members to a sales page for membership to join these events.
Or, you may be using a directory plugin that you list special partner offers for members only. You could set a category of these “premium offer” listings that require membership.
Just want to restrict single CPTs?
If you want to restrict your Custom Post Type at the singular level, use the Custom Post Type Membership Access add on.