Managing different access levels for site features as well as content is critical for any site that has more than one user. WordPress uses user roles and capabilities to manage access to features and content. By default, WordPress uses five user roles of Administrator, Editor, Author, Contributor, and Subscriber for single-site installations. Roles are used to separate users into groups with common functionalities. Capabilities define which tasks can be performed by a user. We can use roles and capabilities in combination to assign only the necessary permission levels to any given user.
In this recipe, we are going to look at the process of managing permissions by creating custom roles and custom capabilities and assigning the necessary permissions to user roles.