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. This guide will show you how to restrict some WordPress roles to editing single pages. This requires PublishPress Permissions Pro and the PublishPress Capabilities plugin.
Step #1. Create the Roles
First, we'll need to install the PublishPress Capabilities plugin. We're going to copy the Subscriber role. This has a basic set of permissions that we can easily modify. However, if you're using a pagebuilder such as Elementor, you may need to copy the “Contributor” role instead. This is because Elementor has non-standard permissions for post editing.
- Go to Capabilities > Roles.
- Click “Copy” under the “Subscriber” role.
- Enter “Department A” into the “Role Name” box.
- Click “Create Role”.
You will now have a new role called “Department A”. You can now repeat this process to create “Department B” and “Department C” roles.
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 a Permissions 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.
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.