WordPress Restricted Site Access (SAR) - How To - Restrict Content Based on Role (Content Type, Category, URL, Specific Posts)
Restricting Site Content Based on User Role
The WordPress Restricted Site Access plugin is capable of restricting site content based on User role for users after they have logged in. This can be done in four different ways.
Based on the category, type of content (Page, Post, Media, Navigation Menu items etc...), based on URL address strings and on an individual basis for pages and posts.
Restricting Based on Category
It's possible to restrict all content of a certain category to specific roles. This features was introduced on version 1.4.1. This rule has the priority when it overlaps with other restriction rules.
Note that this is available to categories of all post types, even custom ones.
To do so, simply edit that category. You will see a checkbox list of all roles. Mark which should access to this category.
Default is Access To All Roles
Note that, if no role is chosen, all roles will have access (the feature will be disabled).
Restricting Content Based on URL String
For URL restricting there are different options on what kind of URL match you would like to filter out. They can be for the whole URL, for Wildcards and for Regular Expressions.
To begin with filtering Users from access to content based on URL filtering, from the WordPress admin panel navigate to CM Site Access Restriction Pro → URL Filters.
A list of existing URL filters that have been created will display if any have been made already. Above the list is the button to Add new filter, click this to begin creating a new Site access restriction URL filter.
Enter the URL string that you would like to filter remembering to omit the domain root part. e.g. if you were going to filter ' cminds.com/wordpress/Site_access_restriction' you would just enter 'wordpress/Site_access_restriction'.
In the next column select Access restricted by role radio button to reveal the different User roles on the site for whom access to the content is to be granted.
Check the box to the left of any user role that you would like to grant access to.
Scroll to the bottom of the page and click Save filters.
The page will refresh and the newly created filter will remain as it was before. Now whenever a user attempts to view a page on your site with a URL matching the filter they will be redirected to the Access Denied page unless their user role is one that was selected within the filter.
Restricting Based on Content Type
To restrict all Posts, Pages, Media etc for users of a certain Role on the site, from the WordPress admin panel navigate to CM Site Access Restriction Pro → Settings → Post Types.
Identify the Content type that you would like to Restrict to a particular role or roles from the list displayed.
Check the radio button to the left of the option labeled Access restricted by role for that content type.
A list of User roles on the site will appear. Choose the User roles that you would like to allow to have access to this content type by checking the checkboxes beside them.
Scroll to the bottom of the page and click the Save button to save the changes.
Now any logged in user attempting to access this content who don't have permission will be redirected to the Access denied page.
Restricting Content on Specific Pages or Posts (Metabox)
Should you wish to restrict content to certain user Roles on a case by case basis for content this option is for you.
Within the editor page of the Page / Post / Media etc, on the right a new metabox will be available to Restrict content for this piece of content.
By default it is set to inherit global settings (i.e. will restrict content if URL filtering or Post type filtering are configured to).
Click on the radio button next to Access restricted by role to reveal the different User roles.
From the list select any checkboxes for user Roles whom you would like to grant access to this piece of content. Scroll down a little and click the Update button.
More information about the WordPress Restricted Site Access plugin Other WordPress products can be found at CreativeMinds WordPress Store |
|
Let us know how we can Improve this Product Documentation Page To open a Support Ticket visit our support center |