1. Home
  2. Knowledge Base
  3. Password Protected Categories
  4. Advanced Usage

How to sell access to a protected area of your site

Our Password Protected Categories plugin lets you lock down specific categories of WordPress pages, posts, or any custom post type. Only authorized users can access them. Most of our customers manually give their users the logins to their protected categories. This article will tell you how to automate this process.

You'll learn how to sell access to protected WordPress categories and automatically give purchasers their logins for the hidden content. For example, you might want to do this if you are creating a WordPress membership site where people can buy access to a members-only shop containing exclusive products.

We'll do this using WooCommerce to sell access to the protected area; and Password Protected Categories to create the protected area. Before you start, you should install the free WooCommerce plugin on your WordPress site.

Step 1 - Create a new user role

Create a dedicated user role with the free User Role Editor plugin. Do this by cloning the 'Customer' role that comes with WooCommerce itself. For example, if you are selling access to a hidden members area then you might create a new role called 'Members'.

Step 2 - Create a hidden area on your website

Use Password Protected Categories to create one or more categories of posts, pages, or any custom post type. This category will contain the information that will be hidden from public view. Protect this category by selecting the role you created in Step 1.

Step 3 - Create a product that gives access to the hidden area

Next, go to Products → Add New. Create a WooCommerce product which people will purchase to gain access to the private area you created in Step 2. DO NOT put this product in a protected category, as it should be available for anyone to view.

Step 4 - Give access to people who purchase the product

In the main WooCommerce settings (WooCommerce → Settings), you should disable guest checkout. If you do this, then WooCommerce will automatically create a user account for everyone who makes a purchase. WordPress will also send them their login details so they can access the hidden area.

Use YITH's Automatic Role Changer plugin to automatically change the role of everyone who purchases the product you created in Step 3. Set it up to automatically change the role from 'Customer' to 'Member' (or whatever you chose to call the new role), thus giving them access to all your private categories.

Step 5 (optional) - Create an email for everyone who buys the membership product

As you saw in Step 4, WordPress will email each customer their login details so that they can access the hidden members-only store. However, this email will be fairly basic and may not be as professional as you would like.

Instead, you can use the Automate Woo plugin to create a custom email that is sent to everyone who buys the product you created in Step 3. This should contain useful information such as how to access the private members-only area.

Once someone has purchased access to the hidden area of your site, you need to make it easy for them to find it.

You can easily do this by going to Appearance → Menus and adding links to your private categories to your website menu. The Password Protected Categories plugin will only show these links to logged in users with access to these categories. The links will be hidden from everyone else.

Note: To use this feature, you must untick the 'Show password protected categories and posts to visitors' box on the Password Protected Categories plugin settings page.

Can people subscribe for continued access?

Yes - we recommend the WooCommerce Subscriptions plugin for this.

Can I expire people's access to the hidden area?

Yes, you can do this by using the free Expire Users plugin to automatically expire people's user logins - and therefore revoke their access to the private area - after a specific period has elapsed.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.