WP_Role::add_cap( string $cap, bool $grant = true )

Assign role a capability.


Description


Parameters

$cap

(string) (Required) Capability name.

$grant

(bool) (Optional) Whether role has capability privilege.

Default value: true


Top ↑

Source

File: wp-includes/class-wp-role.php

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

Top ↑

Changelog

Version Description
2.0.0 Introduced.