How to Get WordPress User Capabilities

You may need to have some roles defined if you’ve multiple type of users on your WordPress blog and each type of user needs to be dealt differently. For instance you’ve a group of contributors who submit their content, that content is checked by another type of users called editors, while your editors should not be able to do any other admini related activity on site, i.e. adding/editing users, for that you might need admin account.

Roles and capabilities in WordPress facilitate the blog owner to easily control and manage multiple type of user groups. In WordPress, following are the basic user roles set by default.

1) Administrator:
The administrator has a complete command over every capability. He can perform every type of capabilities.

2) Editor:
Editor has limited rights as compared to Administrator. He can create, edit and delete main items of pages. He can also edit posts and comments.

3) Author

Author is allowed to perform the functions like He can view other user articles, edit, create and publish his own written articles.

4) Contributor
The Contributor can execute such type of capabilities like he has a access to view other writers articles, submit articles and edit unpublished ones.

5) Subscriber
Subscriber is one who has the most limited access and rights on WordPress. He can only perform one task which is, he can only edit his own created profile. Except this capability, he can do nothing.

In order to make changes in the basic roles, you must need to get a list of User Capabilities first. A simple code will show you the details of capabilities on each user group on your WordPress site. Follow the steps to get the details displayed.

Instructions

  • 1

    Open a new file in notepad.

  • 2

    Write this simple code:


    require_once('./admin.php');
    global $wp_roles;
    echo "
    ";
    print_r($wp_roles);
    echo "done";
    ?>

  • 3

    Now save the file. Name it as roles.php

  • 4

    Open your FTP client and upload the file roles.php in wp-admin folder which will be found in public_html.

  • 5

    Once the file is uploaded in wp-admin folder. Go to your Wordpress Dashboard and open the following path:
    yoursite.com/wp-admin/roles.php

    Please, note that 'yoursite.com' will be replaced with your domain name.

  • 6

    The file will display a detailed information about roles and capabilities each user group has on your Wordpress site. This is very useful information especially when you want to restrict a specific group from performing certain activities and want to see where exactly to make changes.

Leave a Reply

Your email address will not be published. Required fields are marked *


3 × = six