Recent

REST_Controllerclass

REST_Controller

Registers Knowledge Base specific REST API endpoints.

Namespace: WebberZone\Knowledge_Base\REST
Since: 3.0.0
Source: includes/rest/class-rest-controller.php line 27

Methods

__construct()

Constructor.

Line: 47

public function __construct(  );

register_routes()

Register plugin endpoints.

Line: 63

public function register_routes(  );

get_category_product_data()

Return product data for a section term.

Line: 219

public function get_category_product_data( $term_data ): array|null;
Type Name Description
array $term_data Term data array.

Returns: array|null — Product data or null when unavailable.

can_read_ability_route()

Check whether the current user can read a route-backed ability.

Since: 3.2.0
Line: 293

public function can_read_ability_route( string $route_slug ): bool;
Type Name Description
string $route_slug Route identifier.

Returns: bool — Whether the route is readable.

get_sections_for_products()

REST callback: return hierarchical sections filtered by product IDs.

Line: 307

public function get_sections_for_products( WP_REST_Request $request ): WP_REST_Response|WP_Error;
Type Name Description
WP_REST_Request $request Request instance.

Returns: WP_REST_Response|WP_Error

get_hierarchical_sections()

Get the hierarchical section tree, optionally below a parent section.

Since: 3.2.0
Line: 390

public function get_hierarchical_sections( int $parent_id = ... ): array|WP_Error;
Type Name Description
int $parent_id Parent section ID. Zero returns top-level sections.

Returns: array|WP_Error — Section tree or an error.

get_knowledgebase_posts()

Fetch paginated knowledgebase posts.

Line: 456

public function get_knowledgebase_posts( WP_REST_Request $request ): WP_REST_Response;
Type Name Description
WP_REST_Request $request Request.

Returns: WP_REST_Response

get_single_knowledgebase_post()

Retrieve single Knowledge Base post.

Line: 541

public function get_single_knowledgebase_post( WP_REST_Request $request ): WP_REST_Response|WP_Error;
Type Name Description
WP_REST_Request $request Request.

Returns: WP_REST_Response|WP_Error

get_products()

Fetch all knowledge base products.

Line: 584

public function get_products(  ): WP_REST_Response|WP_Error;

Returns: WP_REST_Response|WP_Error

Fetch related Knowledge Base articles.

Line: 629

public function get_related_articles( WP_REST_Request $request ): WP_REST_Response|WP_Error;
Type Name Description
WP_REST_Request $request Request.

Returns: WP_REST_Response|WP_Error

get_search_results()

Lightweight Knowledge Base search.

Line: 678

public function get_search_results( WP_REST_Request $request ): WP_REST_Response|WP_Error;
Type Name Description
WP_REST_Request $request Request instance.

Returns: WP_REST_Response|WP_Error

search_articles_for_ability()

Search Knowledge Base articles and format the Abilities API response.

Since: 3.2.0
Line: 758

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

Returns: array|WP_Error — Search results or an error.

get_sections_for_ability()

Get the hierarchical sections response for the Abilities API.

Since: 3.2.0
Line: 861

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

Returns: array|WP_Error — Section tree or an error.

bump_cache_version()

Increment cache version (global invalidation).

Line: 1124

public function bump_cache_version(  ): void;

Returns: void

maybe_bump_on_status_change()

Maybe bump cache on status change.

Line: 1137

public function maybe_bump_on_status_change( $new_status, $old_status, $post ): void;
Type Name Description
string $new_status New status.
string $old_status Old status.
\WP_Post $post Post object.

Returns: void

maybe_bump_on_post_delete()

Maybe bump cache when KB post deleted.

Line: 1149

public function maybe_bump_on_post_delete( $post_id ): void;
Type Name Description
int $post_id Post ID.

Returns: void

maybe_bump_on_term_change()

Maybe bump cache when KB terms change.

Line: 1164

public function maybe_bump_on_term_change( $term_id, $tt_id = ..., $taxonomy = ... ): void;
Type Name Description
int $term_id Term ID.
int $tt_id Taxonomy term ID.
string $taxonomy Taxonomy.

Returns: void

maybe_bump_on_term_meta_update()

Maybe bump cache when section meta updated.

Line: 1178

public function maybe_bump_on_term_meta_update( $meta_id, $term_id, $meta_key ): void;
Type Name Description
int $meta_id Meta ID.
int $term_id Term ID.
string $meta_key Meta key.

Returns: void