Can I restrict in_category instead of is_category?

For the Category Access Restrictions, I want to restrict only the posts themselves, and not the Category page. So if there are 10 Posts in Cat=A, I want the Cat=A page to be fully visible, but when a user clicks into one of the posts, the Post itself is restricted. Is this possible? Basically I want to restrict in_category instead of is_category.

I see the “Specific Page/Post Restrictions”, but I have thousands of posts that need to be blocked based on Category and a few dozen new Posts each day that may need to be restricted automatically too

You are looking in the wrong place. Specific Page/Post Restrictions are for selling access per post or page.

Use the Post Access Restrictions (at the top of the same admin page) to hide your posts, and just don’t put anything in Category Access Restrictions.

Thank you for your fast response! Yes I see you are correct that the Post Access Restrictions works as I intend it: it only restricts the Post, but not the archive.

However, I have 11,000+ posts in 20 different categories. How can I use Post Access Restrictions to restrict Cat=(array(A,B,C))? It seems like my only option is to manually enter thousands of post IDs?

You could simply choose to protect them all, and then write a filter to override that protection if a post is in a specific category. I have provided a couple of examples on these forums of using such a filter. You would need to customize it for your needs.

OK, I understand what you mean. I’ll research some more for these details.

Actually, is there a way to restrict content only at the theme template file level?

For example, with S2 can I create conditional functions within single.php that limit access based on tag, category, or anything else I can do within WP? For example something like this (simplified):

if ( in_category('15') ) : 
if( user_can_access( get_current_user_id(), get_the_ID() ) ) {
	// user can access
} else {
	// user cannot access
}
endif ;

If so, then I just need to create the levels within S2 and then I can use themes to do all my work?

Is there a function user_can_access?

No there isn’t that function. That is only an example for a conditional statement to restrict access based on if a Post is in a certain category. Are there functions I can use? I can’t find mentions of any function. Thanks for your help!

Read the instructions under API/Scripting.

Sorry to bother you but I can’t find the API/Scripting info in the codex:
https://www.s2member.com/codex/

Any place else it could be?

Look in your site under s2Member ->API/Scripting