WordPress at a glance
function is not described

WP_Role::add_cap() public WP 2.0.0

Assign role a capability.

It's a method of the class: WP_Role{}

No Hooks.

Return

Null. Nothing.

Usage

$WP_Role = new WP_Role();
$WP_Role->add_cap( $cap, $grant );
$cap(string) (required)
Capability name.
$grant(true/false)
Whether role has capability privilege.
Default: true

Changelog

Since 2.0.0 Introduced.

Code of WP_Role::add_cap() WP 5.5.1

<?php
public function add_cap( $cap, $grant = true ) {
	$this->capabilities[ $cap ] = $grant;
	wp_roles()->add_cap( $this->name, $cap, $grant );
}