I need custom post types on my site that are exclusively accessible by certain roles. How can I assing a cpt to certain roles?
I work with members plugin and the content restriction metabox that allows for the default wordpress posts and pages to select roles for access permission does not appear with the custom post types.
I can see my cpts in members and assign the capabilities to roles. This part works just fine. But when I create a custom post the metabox for content restrictions does not show. Obviously, the cpts don’t support this metabox feature.
Maybe there’s a possibility to code:
check user roles
if roles are “teacher1” or “student1”
cpts array slugs=’xyz’, ‘abc’,’rtl’ is accessible
else: show landingpage: http://www.sorry-you-are-not-allowed
- The topic ‘How restrict custom post type too user role’ is closed to new replies.