Grant members early access to content with WooCommerce Memberships

4 min read
Juliana Laraburu

Memberships makes it easy to restrict site content to members and to drip content based on how long someone has been a member. However, sometimes you may want to temporarily give early access to content to members, only making that content publicly available to non-members after some amount of time has passed.

There are any number of cases where that style of a content rollout could be valuable. A publisher with free and paid content might want to make the free content “members only” at first. A company that holds webinars could restrict speaker slides to members first. You might even want “early content access” to be a perk of membership that you use as a selling point.

In this article, we’ll walk through how to provide your members with early access to content, then automatically open it up to non-members after a certain amount of time.

Create an “early access” category

First, we’ll create a category for the posts and/or pages we want to temporarily restrict.

In this example, I’m calling the category Early Access. You can call this whatever you’d like, but keep an eye on the slug field here—we’ll need that later! (In this case, it’s early-access.)

Create early access category

Now we can apply the category to a post or page that we want to restrict to members only. Don’t worry, we’ll set up a way to automatically remove this category later when we’re ready for non-members to see this.

Create early access category

Grant access with your membership plan(s)

Next, we’ll need to restrict our Early Access category so it’s only accessible to our members. Here, I’ve created an Early Access Member plan and restricted our Early Access category to members of this plan. However, you don’t need to create a new membership plan specifically for early access to content (unless that fits your business model). You can give early access to members on any or all of your existing plans.

Add new membership plan

With this plan saved, our post is non hidden from non-members. The message below can be adjusted in the WooCommerce Memberships settings so you can give non-members an idea of when the post will be available if they visit its page:

New Harry Potter Book Revealed

Remove access restrictions on a schedule

With members and non-members now seeing exactly what they are supposed to see, it’s time to add the bit of magic that removes the Early Access category from our posts—and, as a result, opens it up to non-members.

Note: You’ll need to make sure that you know how to add PHP to your site to do this. You could add this snippet to your custom child theme, create your own custom plugin, or use a plugin like Code Snippets to add your code.

The sv_wc_memberships_schedule_early_access_check function schedules the category removal event to run one week after the post is published. You can change +1 week to adjust the length of time to allow the members-only access. For example, you could change this to +3 days or +24 hours, depending on how long your non-members should wait for your exclusive content.

The sv_wc_memberships_remove_post_cat function removes the category, which makes the content available to everyone. If you’ve chosen a different name for your category, you’ll need to replace early-access with your category’s slug.