WP_Role::add_cap

Advertisement

Summery Summery

Assign role a capability.

Syntax Syntax

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

Parameters Parameters

$cap

(string) (Required) Capability name.

$grant

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

Default value: true

Source 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 );

Advertisement

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.