Restricting the content within a Post or Page is very easy with Restrict Content Pro, and there are several different ways you can do it.
You can easily restrict the entire contents of a post or page by simply selecting the desired options in the "Restrict This Content" box, or you can restrict portions of content using the provided shortcodes. Both of these methods are explained in detail below.
Restricting Entire Posts / Pages
On every post, page, and custom post type is a meta box called Restrict this Content. It has several options, which will allow you to restrict the entire contents of your post or page to registered users only, either free or paid.
By default, pages are not restricted. In the screenshot above, Everyone has access to read the content.
Now let's go through all the restriction options available.
Subscription Level Restrictions
To require visitors have some kind of subscription to access content, free or paid, you can select the Members of subscription level(s) option in the dropdown, and then select Members of any subscription level(s). This makes it so your content is only visible to active members of any subscription level, free or paid. Anonymous logged out users will not be able to read the content. See the screenshot below.
To restrict your content so that only members with any paid subscription can view it, select the Members of subscription level(s) option in the dropdown, and then select Members of any paid subscription level(s). Only members with paid subscriptions will be able to see the content. Members with free subscriptions will not be able to see the content. See the screenshot below.
To restrict your content to members of a specific membership level, select the Members of subscription level(s) option in the dropdown, and then select Members of specific subscription levels, and then select the subscription levels you want to have access to the content. See the screenshot below.
In the screenshot above, only members with the Plus membership can view the content. You can select as many or few subscription levels as you like.
Access Level Restrictions
To restrict your content based on a member's access level, select Members with an access level in the dropdown, and then select the lowest access level you want to be able to access the content. See the screenshot below.
User Role Restrictions
To restrict your content to members with a certain user role, select Members with a certain user role in the dropdown, and then select the user role(s) you want in the list that appears below. See the screenshot below.
In the screenshot above, users with the role "Contributor" will be able to see the content. If you want the content to be visible to all logged-in users, even those without a membership, select Subscriber in the dropdown. Subscriber is the default role a user receives in WordPress when his or her account is created.
You can combine some restrictions to create a more granular access control system if needed. For example, you can require that users have a certain membership plus a certain user role. See the screenshot below.
In the screenshot above, only members with the Gold membership and the Contributor user role will be able to see the content.
Restricting Content By Category
You can automatically restrict posts to certain subscription levels, access levels, and paid status based on the category they are filed in.
To set up the category restrictions, go to WordPress Dashboard > Posts > Categories and click "Edit" on the category you wish to set up restrictions for. Any post put in a restricted category will be automatically restricted to members that have the proper membership access.
For more information, see Restricting Content by Category.
Restricting an Entire Post Type
You can quickly apply restrictions to all posts in a post type by navigating to the "Restrict Access" submenu in the post type's menu. The regular post restriction meta box will be available, but the settings you choose here will apply to every post at once. This option is perfect if you want each post to have the same settings.
For more information, see Restricting an entire post type.
Restricting Portions of Content
Instead of automatically restricting the entire contents of a post/page with the meta box option, you can also restrict only portions of the content with a shortcode. This method is more flexible and is best suited for users who want to block off sections of their content to subscribers, while leaving other blocks open to all users.
To restrict a portion of content, use the [restrict] shortcode. The shortcode will allow you to "hide" blocks of content from all but authorized users.
For example, to restrict a block of text to logged-in users only (both free and paid), you can do this:
[restrict]This is the restricted text[/restrict]
If a user is not logged in, then they will see a message like this (text is defined in settings):
You must be logged in to view this content.
The above example uses the shortcode in its simplest form, with no parameters. To get a little more advanced, and restrict the content to paid subscribers only, you can use a shortcode like this:
[restrict paid=true]This is the restricted text[/restrict]
When the paid=true parameter is set, then the "Premium Content Message" in Settings will be used.
You can also define a custom message to be shown, instead of using the messages set up in the settings page. To show a custom message to unauthorized users, use this:
[restrict paid=true message="This is the custom message"]This is the restricted text[/restrict]
It is also possible to restrict a block of text to users of a minimum user level with shortcodes as well. To hide content from all but users with a role of "Author" or greater, use this:
[restrict userlevel="author"]This is the restricted text[/restrict]
You can also restrict content to only users of a specific subscription level by using the "subscription" parameter. If your "Gold" subscription level has an ID of "3", you would use this to limit the content to only Gold subscribers:
[restrict subscription=3]This is restricted to gold subscribers[/restrict]
To allow users from multiple subscription levels to see the content, separate IDs by a comma:
[restrict subscription="3,5"]This is restricted to gold and platinum subscribers[/restrict]
It is also possible to restrict content to only users subscribed to a subscription level that provides a certain access level or higher. For example, if you wanted to restrict content to only users with a subscription that provides an access level of 4 or higher, you would use:
[restrict level=4]This is restricted to subscribers with an access level of 4 or higher[/restrict]
Below is a Short Code Reference list of the user roles available:
There are also a variety of other shortcodes available that allow you to restrict content in various ways. Read the section below to learn more about each of these shortcodes.