Allow WordPress User Roles to Edit a Single Page
A PublishPress user asked us an interesting question:
Can I set up my WordPress site so users from “Department A” can edit only one page and users from “Department B” can only edit a different page?
Yes, that is possible with the PublishPress plugins and I'm going to show you how it's done:
Step #1. Create the Roles
First, we'll need to install the PublishPress Capabilities plugin.
- Go to Users > Capabilities.
- Choose “Subscriber” under “Select Role to View / Edit”.
- Click “Load”.
- Enter “Department A” into the “Copy Subscriber Role” box.
- Click “Copy”.
You will now have a new role called “Department A”. You can now repeat this process to create “Department B” and “Department C” roles. You'll be able to see these new roles in the “Select Role to View / Edit” dropdown:
Step #2. Add the Users to Roles
Now you can go to your “Users” area and add users to these different roles. I've added one user to each of my three new roles:
Step #3. Create the Pages
The next step requires installing the PublishPress Permissions Pro plugin.
After installing the PublishPress Permissions Pro plugin, go to create a new Page. Down below the content, you can see the “Editing Exceptions” area. Here you can choose the roles that are allowed to edit this page. I've created a Page for “Department A” users, so I will change the settings for those users to “Enabled”.
Repeat this process by creating Pages for Department B and Department C users. Make sure to set the correct permissions using the “Editing Exceptions” area.
Step #4. Test the user accounts
At this point, I would highly recommend testing the user accounts to make sure their permissions are accurate. If you're using dummy users, you can reset their passwords. If you're testing with real users, the User Switching plugin is very helpful.
In this example, the Department A users will only be able to see the “Pages” menu link and the single Page for which they have editing access. They will not see the Pages for any other department.