Creating password protected WordPress categories
How to create password protected WordPress categories
- To create password protected categories for any type of WordPress content, go to the Categories screen for the relevant post type (e.g. Posts → Categories). Click the option to either add a new category or edit an existing one.
- In the ‘Visibility’ section above the ‘Add New Category’ button, select ‘Password protected’ and enter the password. You can add anything you like here.
You can password protect as many of your WordPress post or custom post categories as you like, and leave others public.
Each category can have one or more passwords. To add more passwords for a category, click the plus (+) icon next to the password box and add a new row for each additional password. Enter the passwords in the white boxes.
Click the minus (-) icon to delete a password.
Password protecting sub-categories
It’s possible to create more complex navigation structures by password protecting a category and adding ‘child’ categories to it. You can do this by adding a new category and selecting your password protected category as the ‘Parent’.
The password for the main ‘parent’ category will automatically apply to all its child categories so you don’t need to protect each one individually. For this reason, the sub-categories should be set to 'Public'.
When a user tries to view the main parent category, a child category, or any of the posts within these categories, they will be promoted for the same password. Once they have entered the password, they will automatically have access to all these categories and their posts.
How to password protect an entire blog, portfolio or other content type
You can use the WordPress password protect plugin to password protect your whole blog section or an entire custom post type.
- Create a main category for your posts or custom post type and password protect it (see above). You can then structure all the content within the post type by adding sub-categories. Add all the posts to the main category and/or its sub-categories. You should leave the individual sub-categories set to ‘Public’ as they will automatically be protected with the same password as the main parent category.
- Go to Settings → Protected Categories and make sure the ‘Show password protected categories and posts to visitors’ box is not ticked.
How to make categories private to logged in users only
As well as password protected categories, the plugin lets you create private categories that are only visible to logged in users depending on their role. Please see the separate article on creating private categories.
How to create a category login page
There are 2 ways for people to log into your password protected categories. Please see our article on category login pages.
How to password protect WooCommerce categories
You can use the Password Protected Categories plugin to password protect WooCommerce categories. However if you’re using it for WooCommerce then you might prefer our other plugin, WooCommerce Password Protected Categories.