WordPress Restricted Site Access (SAR) - Use Case - How to Limit the Access to Specific Post/Page On Specific Day


Use Case – How to Limit the Access to Specific Post/Page On Specific Day.

Back to User Guides

Note: This guide requires:

Video Use-Case


Introduction

WordPress Restricted Site Access is a plugin that allows you to create a membership and content restriction solution. The content restriction is based on user WordPress roles and if they are logged in or not. Choose which post type, category or even specific page should be locked – and to whom. 

Use Case Front-End

Example of restricting the access on specific day - Content Control WordPress
Example of restricting the access on specific day

Use Case Assumptions

In this example use case guide we will consider how to limit the access to specific posts or pages on specific day or period of time. We will consider the process on the example of restricting the access for WooCommerce products and shop - this process can be applied the same way for any post type or page.

We consider that you have already bought the plugin, but not installed it yet.

It follows:

Installing the Plugin

The process is the same for all CM plugins and add-ons.

CreativeMinds Customer Account Dashboard - Downloads tab
CreativeMinds Customer Account Dashboard
  • Download the plugin from your customer dashboard.
  • Log in to WordPress and navigate to the WordPress Admin → Plugins settings.
  • Click on Add New.
  • Activate it and add the license.

Learn more: Getting Started - Plugin Overview


How Content Restriction Works

The WordPress Restricted Site Access plugin allows users to create a membership and content restriction solution. The content restriction is based on user WordPress roles and if they are logged in or not.

Front-End Examples

Examples of full and partial content restriction - Page Restriction WordPress
Examples of full and partial content restriction

The content restriction can be set by the following options:

  1. Specific URL - You can restrict access to specific posts. This can also include URL parameters. 
  2. Specific Post / Page - You can restrict access to a post, page or any custom post type by editing the post and using the post metabox to restrict access.
  3. Specific Permalink - Some plugins create the fly pages which are only represented by permalink. In such case you can use the admin bar edit option to define content restriction.

    Editing the page - WordPress Restrict Content
    Editing the page
  4. To all posts by type - Using the plugin setting, you can restrict content across all posts of a certain type.
  5. To part of the content - Using a shortcode, you can limit access to part of the content in a post or page only to specific roles, user id or user action.

Let's start first with the general setting up the plugin and then consider content restrictions methods step by step.

Setting Up

Navigate to Admin Dashboard → CM Site Access Restriction Pro → Settings.

Navigation to the plugin settings - Content Gate
Navigation to the plugin settings

Head to the General tab.

General settings tab - Content Dripping WordPress Plugin
General settings tab

Here we need just a few settings for configuring.

  • Access Denied page URL - The page, where the user will be redirected if he tries to access the page which is restricted.

    Specifying the 'Access denied' page path - Tiered Membership
    Specifying the 'Access denied' page path
  • Login page URL - The page, where the user will be redirected if he is not logged-in and tries to access the page which is restricted. If the user logged-in, but his user role is not allowed to access the page, he will be redirected to the page defined in the previous option. Let's keep this field empty now, as we are not going to restrict the access for logged-in users or by user role in this use case.

    Field for specifying the link to the login page - WordPress Restricted Site Access
    Field for specifying the link to the login page

    Restriction type - Here you can choose how much of the content is restricted:

    Choosing the global restriction type - Content Control WordPress
    Choosing the global restriction type
    • Restrict full content - Restrict all content on the page. Let's choose this option for our example.
    • Restrict partially content - Showing some percentage of the content with a fade effect and message (configurable in the labels section). The percentage is defined lower in the option Restrict partially content percentage.

      Example

      Example of the partial content restriction - Page Restriction WordPress
      Example of the partial content restriction
    • Restrict content with shortcode only - Show all content except those parts that are restricted by the [access] shortcode. Learn more about this shortcode.

      Note: The setting Restriction type can be overridden for every post type in the next tab Post Types, and it can also be overridden for every specific post or page in the metabox.

  • Restrict partially content percentage - Set the percentage of how much content should be displayed when the option Restrict partially content is enabled. Default value is 20%.

    Specifying how much % of the content will be shown with the partial content restriction method - WordPress Restrict Content
    Specifying how much % of the content will be shown with the partial content restriction method

Restricting Posts, Pages and More

There are a few ways, how you can limit the access to a post or page for a specific date or period of time. Let's start with restricting all posts of a definite type. In our case it will be Products of WooCommerce.

Head to the next tab of the settings - Post Types.

Post types settings tab - Content Gate
Post types settings tab

In this section you can restrict all posts which belong to a custom post type, as well as restrict access to general pages and posts. There is a long list of items that you can restrict.

For our use case, to limit the access to products on a specific date or period of time, we need the following options in the Products section:

  • Access restricted by specific date/time - The access is allowed only within defined period of time. You need to set start and end dates in the fields From and To. Let's set here the period of time from 1st to 30th November. It means that all WooCommerce product pages will not be available before and after defined period of time.

    Choosing the period of time when the post type will be available for access - Content Dripping WordPress Plugin
    Choosing the period of time when the post type will be available for access
  • Restriction type - Here you can optionally choose the type or restriction between Global settings or 3 options that override options in the General tab of Settings.

    Overriding global restriction type - Tiered Membership
    Overriding global restriction type

At the end of configuring the settings click the Save button to save the changes.

Saving the changes - WordPress Restricted Site Access
Saving the changes

Restricting Specific Post

You can control the access to specific pages, posts or other custom post types using a metabox located in each page or post once editing the post.

You can edit posts or pages in two ways.

1) Open the list with products, for example, and click the  Edit button by hovering on the needed product:

Product edit link on the back-end - Content Control WordPress
Product edit link on the back-end

2) Another way can be useful, when some plugins create the fly pages which are only represented by permalink. In such case you can use the admin bar edit option to define content restriction:

Product edit link on the front-end - Page Restriction WordPress
Product edit link on the front-end

In both cases you can find the metabox Site Access Restriction. It looks the same as in Settings → Post Types tab, and it works the same. The difference is - in plugin Settings you define global settings for all posts of chosen type, and in metabox you can configure Access Restriction for specific post that overrides global settings. And here you can also choose the option Follow access global options for this post type. So, let's set the specific date when the chosen product will be available for users in the Access restricted by specific date/time. As a result, this post will be not available on any other day except 5th November.

Overriding the global time restriction and setting only a certain day for access to this specific product - WordPress Restrict Content
Overriding the global time restriction and setting only a certain day for access to this specific product

When you change the settings don't forget to click the button Update or Publish at the top right to save the changes.

Result

Restricting the access to the product only on specific date - Content Gate
Restricting the access to the product only on specific date

Restricting With URL Filter

The plugin also supports restricting access to specific URLs on your site. This is very useful when you want to prevent access to specific sections of plugins which use get params or you want to define only specific pages or posts.

To add a URL filter, navigate to Admin Dashboard → CM Site Access Restriction Pro → URL Filters

Navigation to the URL filters dashboard - Content Dripping WordPress Plugin
Navigation to the URL filters dashboard

Click the Add new filter button.

Adding new URL filter - Tiered Membership
Adding new URL filter

There you can see the field where you can put needed URL. You need to enter the exact URL address you want to match without the hostname part. 

Let's restrict the access to the Shop page.

Example of the shop page URL - WordPress Restricted Site Access
Example of the shop page URL

So, in our use case we need to add /shop/ to the URL field.

Restricting access to the 'Shop' page on the specific period of time - Content Control WordPress
Restricting access to the 'Shop' page on the specific period of time

The Access Restriction settings for URLs are the same as in the previous cases and they override global settings. So let's set the period of time when this page will be available for users in the Access restricted by specific date/time - from 1st to 30th November.

You can add as many URLs for restricting as you need using the Add new filter button, and don't forget to click the Save filters button to save them. You can also remove not needed filters using the button Delete.

Result

Example of restricting access to the site shop on specific time period - Page Restriction WordPress
Example of restricting access to the site shop on specific time period

End Result

Following instructions found in the plugin and guides, you should be able to limit the access to specific posts or pages on specific day or period of time. 

Use Case Front-End

Restricting access to the product only on specific date - WordPress Restrict Content
Restricting access to the product only on specific date

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
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.