Recent

AbilityclassPro only

Ability

Registers the knowledgebase/ask ability with the WordPress Abilities API.

The ability runs through the same Ask_Handler as the REST endpoint, so it has the same guards: module enabled, provider configured, question validation, answer cache, per-caller rate limit and daily cap. The REST endpoint’s same-origin check cannot apply to the Abilities API route, so the ability is limited to logged-in users by default.

Namespace: WebberZone\Knowledge_Base\Pro\AI
Since: 3.2.0
Source: includes/pro/ai/class-ability.php line 26

Methods

__construct()

Constructor.

Line: 54

public function __construct( Ask_Handler $handler );
Type Name Description
Ask_Handler $handler Ask handler.

register()

Register the ability.

Since: 3.2.0
Line: 69

public function register(  ): void;

Returns: void

get_input_schema() static

Input schema.

Since: 3.2.0
Line: 104

static public function get_input_schema(  ): array;

Returns: array — JSON schema.

get_output_schema() static

Output schema, matching the REST response.

Since: 3.2.0
Line: 127

static public function get_output_schema(  ): array;

Returns: array — JSON schema.

check_permission()

Permission check. Logged-in users only by default, because the Abilities API route has no same-origin check.

Since: 3.2.0
Line: 200

public function check_permission( $input = ... ): bool;
Type Name Description
mixed $input Ability input.

Returns: bool — True if allowed.

execute()

Run the ability.

Since: 3.2.0
Line: 220

public function execute( $input = ... ): array|\WP_Error;
Type Name Description
mixed $input Ability input.

Returns: array|\WP_Error — Response data or error.