Content view access restriction for selected roles

Activate “Content View Access Restrictions” module at User Role Editor Settings page:

Content view access restriction activation
Content view access restriction activation

Post level restrictions

Starting from version 4.10 you may restrict view access for posts and page on the user roles base. If you wish to restrict the post views by members of the selected roles only follow these steps:
1) Open the post for edit, scroll to “Content View Restrictions” metabox.
2) Select the access restriction action. Two options are available: “Prohibit” or “Allow”.

Content view access restriction metabox
Content view access restriction metabox

3) Click “Edit Roles List” button and select role(s) for which you wish to apply access restriction action. Click “Save” button, check that roles list at the readonly textarea was updated.
Content view access restriction roles selection
Content view access restriction roles selection

Do not forget to click “Update” button to save full changes made to the post including roles list you just built.
Post update
Post update

That’s done. This post is available for logged-in users only. If you selected action “Prohibit”, that this post is available for the all roles except included into roles list. If you selected action “Allow”, that this post is available only for the roles included into roles list.

The example of using this feature with WooCommerce products and categories:

WooCommerce products – restrict view by category

Role level restrictions

Starting from version 4.19 it’s possible to set posts/pages view restrictions for the selected role:
Select role and click “Posts View” button:

Posts View button
Posts View button

At opened dialog select/input appropriate access restrictions options:
Posts access options
Posts access options

  • Zach Bennett

    Would it be possible to use this feature to restrict access to static HTML pages and their supporting assets (JS, CSS, images, etc)? I want to store my content somewhere it can’t be accessed publicly, then only serve those pages to my WP users who are logged in and have the proper roles.

    • This feature protects WordPress pages by URL. If user does not login or has no required role he can not open protected page.
      If user knows direct link to JS, CSS or image files, he may download it without login even if page itself is protected.