Allow WordPress Users to Only Read Some Pages
One PublishPress user asked us if it is possible to set up a site with this feature:
- Joe can see only pages A, B, C.
- Bob can see only pages D, E, F.
Yes, this is possible with the PublishPress plugins. For this, we recommend using PublishPress Permissions Pro. This is our advanced permissions plugin and allows you to customize permissions for specific users.
- Install the PublishPress Permissions Pro plugin.
- Install the User Switching plugin. This will help you test your new user accounts.
- Create the user accounts you want to use. In this example, I've set up both users as “Subscribers“. This is a user role with very limited permissions, so it will be easy to configure. This is my “Users” screen with “Bob” and “Joe”:
- Create the pages that you want to control access for. This is my “Pages” screen. I have deliberately avoided choosing either “Bob” or “Joe” as authors, because that would mess with the permissions.
Now we're going to control the permissions for these pages.
- Edit the “A” page. This page will be visible to Joe, but not Bob.
- Scroll down to find the “Permissions: Read this Page” box.
- Set “Subscriber” to “Blocked”.
- Click the “Users” tab.
- Click “select users”.
- Search for “joe”.
- Select “joe”.
- You can now set “joe” to “Enabled”.
- Repeat this process for all six pages.
- When you've finished, you'll see that “Read” is shown in the “Permissions” column. This lets you know that there are custom permissions for this post.
Now you can test these new permissions.
- Go to “Users” in your WordPress admin menu.
- Click “Switch To” for either Bob or Joe.
- Go to the front of your site. Joe will only see pages A, B, C and Bob will only see pages D, E, F.
- If either Joe or Bob tries to access a page they do not have access to, they will see a “Page Not Found” error.