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: 62
public function register_routes( );
get_category_product_data()
Return product data for a section term.
Line: 211
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.
get_sections_for_products()
REST callback: return hierarchical sections filtered by product IDs.
Line: 283
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_knowledgebase_posts()
Fetch paginated knowledgebase posts.
Line: 364
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: 449
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: 492
public function get_products( ): WP_REST_Response|WP_Error;
Returns: WP_REST_Response|WP_Error
get_related_articles()
Fetch related Knowledge Base articles.
Line: 537
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: 586
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
bump_cache_version()
Increment cache version (global invalidation).
Line: 843
public function bump_cache_version( ): void;
Returns: void
maybe_bump_on_status_change()
Maybe bump cache on status change.
Line: 856
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: 868
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: 883
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: 897
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