# wpdirectorykit/1.1.0/custom_user_roles.php

WP Directory Kit, version 1.1.0. 18 lines.

- Page: https://pluginprobe.com/plugins/wpdirectorykit/1.1.0/code/custom_user_roles.php
- Raw: https://pluginprobe.com/plugins/wpdirectorykit/1.1.0/raw/custom_user_roles.php
- Modified: 2022-11-24T13:50:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wpdirectorykit/1.1.0/code/custom_user_roles.php#L10-L20`.

```php
<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

add_action( 'init', 'wdk_custom_user_roles' );
function wdk_custom_user_roles()
{
    add_role('wdk_agent'  , __('Agent', 'wpdirectorykit'), array( 'read' => true, 'level_0' => true ) );

    $role = get_role('wdk_agent');
    $role->add_cap('edit_own_listings'); 
    $role->add_cap('edit_own_profile');
    $role->add_cap('upload_files');
}

?>
```
