Thursday, 16 February 2017

Restricting Access to Custom Post Types Using Roles in WordPress


Custom post types extend the capabilities of WordPress in terms of what types of content can be published and managed, but these days at 3.7 we find ourselves working on projects that need more granular permissions related to custom post types. The most common situation I’ve run into is a particular user (or group of users) needs the ability to manage specific custom post types but shouldn’t have the ability to alter the rest of the site. For example, you may have someone in an organization that needs to manage job listings (a custom post type) but shouldn’t be allowed to edit posts or pages.
For this example, I’ll base the situation off our project management plugin Panorama. Many of our customers need users to manage projects, but don’t want them to have access to any other types of content. There are some good tutorials out there, but many of them are a few years dated and I found a slightly updated approach was necessary to make this work.
What We’re Aiming For
In the case of Panorama, we wanted our “projects” custom post type to be managed by Editors, Administrators and a new role of “Project Managers.” Project Managers
Source: https://managewp.org/articles/14411/restricting-access-to-custom-post-types-using-roles-in-wordpress




source https://williechiu40.wordpress.com/2017/02/16/restricting-access-to-custom-post-types-using-roles-in-wordpress/

No comments:

Post a Comment