Change Role Capabilities

There are several roles you can give your users in WordPress, like Contributor, Author or Administrator. These are pre-defined and has certain capabilities. To change these capabilities and create your own, customized user roles, just add the following to functions.php:

The different roles and capabilities are listed in the WordPress Documentation.

IMPORTANT! The capabilities are written to the database, so if you want to give back a capability to a role, you have to use the add_cap-function.

Code Snippet:

# Get the user role #
$edit_contributor = get_role('contributor');
# Contributor can upload media #
# Contributor can no longer delete posts #

Posted in Admin area