# wpdirectorykit/1.2.7/custom_user_roles.php

WP Directory Kit, version 1.2.7. 18 lines.

- Page: https://pluginprobe.com/plugins/wpdirectorykit/1.2.7/code/custom_user_roles.php
- Raw: https://pluginprobe.com/plugins/wpdirectorykit/1.2.7/raw/custom_user_roles.php
- Modified: 2023-10-17T19:27:58+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.2.7/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');
}

?>
```
