Recent

AbilityclassPro only

Ability

Registers the better-search/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\Better_Search\Pro\AI
Since: 4.5.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_category()

Register the Better Search ability category.

Since: 4.5.0
Line: 66

public function register_category(  ): void;

Returns: void

register()

Register the ability.

Since: 4.5.0
Line: 85

public function register(  ): void;

Returns: void

get_input_schema() static

Input schema.

Since: 4.5.0
Line: 120

static public function get_input_schema(  ): array;

Returns: array — JSON schema.

get_output_schema() static

Output schema, matching the REST response.

Since: 4.5.0
Line: 143

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: 4.5.0
Line: 216

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

Returns: bool — True if allowed.

execute()

Run the ability.

Since: 4.5.0
Line: 236

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

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