NEW IN VERSION 2.0.0: Users with a custom role will now only see the posts or pages they are assigned to. We’ve also streamlined the admin interface for easier configuration, and included additional instructions to help you get the proper capabilities assigned to your custom roles.
Custom Access Roles allows you to create, edit and delete custom roles for editing content. It was created to fill a need for a role editor plugin that is focused on providing easy-to-use admin tools for restricting content editing access. It is not concerned with restricting viewing access on the front end.
It is specifically intended for large sites with multiple content editors, where editors (by role, not individually) need to be restricted to only being able to edit specific areas of the site.
With this plugin, administrators of large sites have relatively fine-grained control over which user roles can edit which content, making it possible to manage a team of editors without concern that they will (accidentally or deliberately) edit content they should not have access to.
You can define a fully customized set of capabilities for each role, along with defining a specific set of post categories, pages, and custom post types to which those capabilities apply. For all other content, the role will have read-only access.
Custom Access Roles provides an easy interface for managing these roles and capabilities, with checkboxes for each capability grouped by the standard roles they’re associated with, plus checkboxes for each post category, page, and custom post type, presented in an organized hierarchy.
- Upload the plugin files to the
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Go to Users > Custom Access Roles to manage roles and capabilities.
How do I grant access to Custom Post Types?
If your CPT has its own capabilities, assign those capabilities to the role. Otherwise, CPTs use the same permissions as Posts. Assign
edit_postsand all similar
edit_*_postscapabilities. Note that this will give these users the ability to edit Posts as well, but only for the specific categories they’ve been given access to using this plugin. This is why “publish_posts” is not enabled by default.
Users who should only be able to edit Posts see the Pages section, and vice versa
The default capabilities set by the plugin assume basic editing capability for both Pages and Posts. If you are creating a role that should only be able to edit Pages, under the Capabilities tab (when configuring the role) uncheck all capabilities containing the word “posts”. Likewise, for roles who will only be editing Posts, uncheck all capabilities containing the word “pages”.
Capabilities for CPTs are a bit more complicated, because some CPTs have their own custom capabilities, while others do not, and default to using the “posts” capabilities. You’ll need to inspect the configuration of the CPT to determine which capabilities are used.
How do I set up an order fulfillment role for WooCommerce?
The “Shop Manager” user role in WooCommerce may have more capabilities than you would like, such as the ability to edit Posts, Pages and Products. It is possible to set up a fulfillment role that is focused mainly on WooCommerce orders, with no access to edit content. Unfortunately because of how the capabilities in WooCommerce are grouped, this role will still have the capability to edit all of the WooCommerce Settings.
Create a new custom role, and under the Capabilities tab, uncheck all of the standard capabilities except “read” (under Subscriber).
Still under Capabilities, scroll down to Custom, and check the boxes for all capabilities that contain the words “shop order(s)”. Also check all of the “read” capabilities that include “product(s)”, “shop coupon(s)”, and “shop webhook(s)”.
Also check the box for “manage woocommerce”. This grants more permissions than we would like, but is necessary to grant any access to the WooCommerce admin pages, including Orders.
Optionally, check “view woocommerce reports” if the user should be allowed to view reports.
Under the Content Access tab, scroll down to Custom Post Types and check “Orders”, “Refunds” and “Coupons”.
Click Save Changes. This role is now ready to use.
以下人員參與了開源軟體〈Custom Access Roles〉的開發相關工作。參與者
將〈Custom Access Roles〉外掛本地化為台灣繁體中文版
- Updated logo and icon assets.
- Updated “Tested up to” to 5.8.1.
- Added conditional to prevent undefined index notices.
- Tested with WordPress 5.0.3.
- Updated admin screen.
- Added ability to assign access to private Custom Post Types, e.g. the “shop_order” post type in WooCommerce. Instructions for setting up a WooCommerce order fulfillment role have been added to the FAQ page.
- Pages and Posts lists now only show items the user can actually edit.
- Improved Custom Access Roles configuration interface.
- Updated FAQ.
- Updated FAQ.
- Updated “Tested up to” to 4.7.
- Minor code cleanup.
- Fixed “Can’t use method return value in write context” fatal error for PHP versions before 5.5.
- Removed anonymous function that was causing errors in PHP versions before 5.3.0.
- Fixed bug in output logic of CARoles::get_current_user_role() method.
- Tested against WordPress 4.6.
- Advanced to official 1.0 release.
- General file cleanup.
- Added banner image for WordPress Plugin Directory.
- Modified plugin description for clarity of purpose.
- Added PHPDoc-format comments to all class methods.
- Original version.