Documentation

CapabilityInterface

Marker for a typed WordPress capability.

Implemented by the closed capability catalogs WpCapability and WooCommerceCapability. Lets the authorization seams accept either enum (or a raw string) through a single string|CapabilityInterface union instead of a two-enum union, so a plugin references WpCapability::ManageOptions instead of retyping the magic string 'manage_options'.

toString() yields the exact WordPress capability string the platform expects (identical to the backed enum's ->value); it exists so callers and static analysis never depend on the concrete backed-enum type.

Table of Contents

Methods

isMeta()  : bool
Whether this is a META capability — one checked against a specific object id (e.g. `current_user_can('edit_post', $id)`) and resolved by WordPress' `map_meta_cap()` at runtime. Meta caps must never be granted to a role; grant the primitive they map to instead.
toString()  : string
The exact WordPress capability string (e.g. `manage_options`).

Methods

isMeta()

Whether this is a META capability — one checked against a specific object id (e.g. `current_user_can('edit_post', $id)`) and resolved by WordPress' `map_meta_cap()` at runtime. Meta caps must never be granted to a role; grant the primitive they map to instead.

public isMeta() : bool
Return values
bool

toString()

The exact WordPress capability string (e.g. `manage_options`).

public toString() : string
Return values
string
On this page

Search results