Private Posts and Pages for WordPress User Groups
In this tutorial, we'll show you how to private posts and pages for some of your WordPress site users. This is what we'll do:
- Use a custom privacy status to control who can see some pages.
- Default newly published pages to that privacy status.
- Allow a limited set of users to access those pages.
All of this is possible with the PublishPress Permissions Pro plugin.
In this guide, we'll create a status called “Legal Team” that is automatically given to new Pages. These Pages will only be accessible to users in the “Authors” role.
Create the new status
First, we'll create a new status to protect our content.
- Go to “Permissions”, then “Post Statuses”.
- Click the “Visibility” tab.
- You'll see “Private”, plus three extra privacy statuses: “Member”, “Premium” and “Staff”.
- Click the “Add New” button.
- We will create a new status and choose to use it only for “Pages”.
- Click “Create”.
Make the status the default for new Pages
Next we will make sure that “Legal Team” is the default status for new pages.
- Go to “Permissions”, then “Settings”.
- Click the “Editing” tab.
- Under “Pages”, choose “Legal Team” as the default.
- You can also check the “lock” option so that no other status can be selected.
- When you create a new page, the visibility will be set to “Legal Team” by default. It will be impossible to choose another option.
- If a Page is published, you will see a dropdown option for “Visibility”. But will only allow you to unpublish the content by moving it to “Draft”.
- Every Page created in the future will now have the “Legal Team” status and will be marked on the main “Pages” screen:
Give users access to this new status
Our final step will be to give some users access to this new “Legal Team” status. We're going to give access to the “Authors” role.
- Go to “Permissions”, then “Groups”.
- Click “Edit” under “WP Author”.
We are going to give people in the Authors role some additional permissions for pages with the “Legal Team” status. For these pages alone, they will also be a “Subscriber” and able to read the content.
- Choose the “Add Supplemental Role” tab.
- Post Type: choose “Page”.
- Role: choose “Subscriber”.
- Visibility: choose “Legal Team”/
- Click “Add Role”.
- Click “Save Role.
You can now test out your new Pages. Only people in the Author role can see Pages with the “Legal Team” status. Everyone else will get a “Page Not Found” error. You could also use PublishPress Permissions to create a Teaser if you wanted to entice people to join your site and get access to this private content.