How to Restrict or Allow WordPress Posts for Specific Dates

In this tutorial, we show you how to restrict or allow access to your WordPress posts for specific dates.

This is very useful for several uses. For example, if you have a blog that is activated only for specific seasons such as Christmas or Easter, you can have the posts published on your site, but only give readers access during the specific season.

You can restrict all the posts, or restrict specific posts for selected dates. This would normally take several hours because you would have to program the changes one by one. However, we want to show you how to do this with the WordPress Conditional Post Restrictions plugin.

With this WordPress Plugin, you can apply a variety of conditions to create specific restrictions for your posts, pages, and any other WordPress post type. In this case, you can apply various conditions to your WordPress posts. For example, you can restrict posts by:

  • IP
  • Post Viewed Count
  • Referer
  • URL
  • User role
  • User email
  • User email company
  • Days since user registration
  • Hour of the day
  • Date
  • Day of the week
  • Day of the month
  • Month of the Year

In this example, we’ll show you how to restrict or allow access for specific posts and for all posts. Let’s just make some ideas clear:

  • Restrict access means users won’t be able to access the posts under the selected conditions. For example, users will be able to access posts on all dates, except on the restricted date.
  • Allow access means users will be able to access the posts under the selected conditions only. For example, users will be able to access your posts on Holidays only.

You decide which method you’ll use: restrict access or allow access.

Just follow these simple steps:

1- Install the ‘WordPress Conditional Post Restrictions’ plugin

Once you install and activate the plugin on your WordPress website, you can proceed to easily restrict or allow your WordPress posts for specific dates.

2- Restrict or allow all WordPress posts GLOBALLY for specific dates

If you want to apply restrictions to all posts on your website, you can easily do so. You only need to create a global condition and apply it to all the posts.

For this, you need to go to Settings > Posts Restrictions.

a) Understanding the global settings

Once there, you’ll see the following fields:

  • Enable restrictions: Tick/untick this checkbox to enable/disable the global conditions.
  • Global restrictions: Here you’ll see all the global conditions you create.
  • Don’t apply restrictions for these user roles: You’ll see a list of user roles for which the conditions won’t be applied. By default, we will not apply restrictions for administrators, editors, and any user with the capability edit_others_posts.
  • What happens when the post is restricted? You have several options to select what happens when the post is restricted:
    • Redirect to URL
    • Remove the content and show a message
    • Show fragment of the content and show message after fragment
  • What happens when a category is restricted? You have several options to select what happens when the post is restricted:
    • Show error 404
    • Show the normal page without posts
    • Show an error message
    • Redirect to another URL
    • Show the content of another page

b) Restrict or allow posts globally on a specific date

Tick the Enable restrictions checkbox.

Then, add a global condition. Just click Add conditions.

Once you open the Add Conditions form, you need to select the following values to restrict or allow your WordPress posts globally.

  • Add new restrictions: Enter the condition title
  • Select post types: Posts
  • What happens when the conditions are met: Allow access / Restrict access. You decide.
  • Condition 1: Date (YYYY-MM-DD) = 2020-10-08
  • Click Publish

The entered date is an example. You need to enter the date using the YYYY-MM-DD date format.

Important

  • If you select Allow access, users will be able to access the posts only on the date selected.
  • If you select Restrict access, users will be able to access the posts on all dates but the selected date.

c) Restrict or allow posts globally on a date range

If you want to restrict or allow posts globally on a date range, you can do it easily with WordPress Conditional Post Restrictions. For example, you can restrict or allow access to your posts in December only.

In this case, we’ll restrict/allow access to our posts from December 1st to December 31st, 2020, so the conditions you need to add needs to have these values:

  • Add new restrictions: Enter the condition title
  • Select post types: Posts
  • What happens when the conditions are met: Allow access / Restrict access. You decide.
  • Condition 1: Date (YYYY-MM-DD) >= 2020-12-01
  • Click the + button on Condition 1 to add an “and” condition
  • Condition 1: Date (YYYY-MM-DD) <= 2020-12-31
  • Click Publish

Important

  • If you select Allow access, users will be able to access the posts only on the date selected.
  • If you select Restrict access, users will be able to access the posts on all dates but the selected date.
  • The date with the “>=” symbol is the initial date
  • The date with the “<=” symbol is the final date

3- Restrict or allow all WordPress posts INDIVIDUALLY for a specific date or date range

Maybe you don’t want to restrict or allow all your posts, but just some individual posts. In that case, you don’t need to apply a global condition; instead, you need to edit the restrictions for each post.

Go to Posts and open the post you want to restrict/allow.

a) Restrict or allow individual posts by a specific date

Once you open the post, scroll down to go to Restriction rules and select these values:

  • Enable content restrictions? Yes
  • What happens when the conditions are met? Allow access / restrict access

Now go to Restrictions and add the next condition:

  • Condition 1: Date (YYYY-MM-DD) = 2020-10-08

Finally, update the post to apply the changes.

b) Restrict or allow individual posts by date range

If you want to restrict this specific post for a date range, you need to apply the following conditions:

  • Enable content restrictions? Yes
  • What happens when the conditions are met? Allow access / restrict access
  • Condition 1: Date (YYYY-MM-DD) >= 2020-12-01
  • Click the + button on Condition 1 to add an “and” condition
  • Condition 1: Date (YYYY-MM-DD) <= 2020-12-31
  • Update the post to apply the changes.

Important

  • If you select Allow access, users will be able to access this post only on the date selected.
  • If you select Restrict access, users will be able to access this post on all dates but the selected date.
  • The date with the “>=” symbol is the initial date
  • The date with the “<=” symbol is the final date

That’s really easy!

With the WordPress Conditional Post Restrictions plugin, you can easily restrict or allow your WordPress posts for specific dates. You can create private post platforms with these easy-to-create conditions.

Something great is that you can avoid 404 errors on your site because you can easily redirect users to any specific URL when your posts are restricted.

Close Menu