Restricting Post and Page Content

Restricting the content within a Post or Page is very easy, 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 short codes. 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 you want in the dropdown that appears below. See the screenshot below.

In the screenshot above, users with the role Contributor or higher 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 Plus membership and the Contributor user role will be able to see the content.


Additional Restriction Settings

In addition to all the restriction options shown above, there are some additional options you can configure. Those are:

  • Show excerpt to members without access to this content. - Lets visitors see the excerpt preview of the content if they don't have access to it. Useful for teasing members into upgrading their accounts and letting search engines index some of the content.
  • Hide this content and excerpt from RSS feeds. - Prevents the content from showing up the WordPress RSS feed.

Here's a look at the whole list of restriction settings mentioned above.


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 setup category restrictions, go to Posts > Categories and click "Edit" on the category you wish to setup 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 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 short code. This method is more flexible and is best suited for users who want to block of 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 short code 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 short code 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 short code 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 setup 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 short codes 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 comman:

[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]

A list of the user roles available is shown in the  Short Code Reference section.

There are also a variety of other short codes available that allow you to restrict content in various ways. Read the section below to learn more about each of these short codes.