The WebberZone Knowledge Base plugin exposes selected functionality via the WordPress REST API.
All endpoints live under the namespace wzkb/v1 and therefore share the base path:
Replace
https://example.comwith your site’s domain.
Authentication & Permissions
- The API piggybacks on WordPress capabilities. Standard WordPress authentication mechanisms (cookies for logged-in sessions, app passwords, basic auth plugins, etc.) all work.
- All REST responses follow standard WordPress structures with
code,message, anddata. - Cache lifetime is 300 seconds. Cache busts automatically on KB content or taxonomy changes, and when the cache is cleared from Knowledge Base → Tools or the settings page.
- When used in a headless context, ensure Gutenberg meta
_wzkb_product_idsand_wzkb_section_idsare synced. - Permissions can be customized per route via the
wzkb_rest_route_permissionOpens in a new window filter. - By default, all read-only routes are public. Use the permission filter below to restrict access.
Permission overrides
Developers can override route-level visibility without replacing the controller. The filter receives the route slug and the default public flag (true for read endpoints).
Return values:
bool– grant/deny outright.string– capability checked viacurrent_user_can().callable– custom logic returning boolean.
Multi-product prerequisite
The Sections endpoint requires multi-product mode in Knowledge Base. Enable Knowledge Base → Settings → General → Enable Multi-Product Mode. If disabled, the Sections endpoint returns a wzkb_rest_sections_disabled error.
TranslatePress translation
Since Knowledge Base 3.1.5, REST responses under wzkb/v1 are translated when TranslatePress is active. TranslatePress never runs its page output buffer for REST requests, so the plugin translates each response directly before it is sent.
Request a language with the lang parameter. It accepts a TranslatePress locale (for example fr_FR) or its URL slug (for example fr):
When lang is omitted, the plugin checks the current request URL and then a referring URL on the same host. Public requests can use published languages. Users with the TranslatePress translating capability can also request configured unpublished languages. An invalid language or the default language leaves the response untranslated.
The optional lang argument is available on all six endpoints below. It must be a string no longer than 20 characters. This response-translation parameter is specific to TranslatePress; WPML and Polylang use their own WordPress translation integrations.
Override the resolved language with the wzkb_trp_rest_language filter:
| Parameter | Type | Description |
|---|---|---|
$language | string | Language code resolved from the request. |
$request | WP_REST_Request|null | REST request that produced the response. |
Return the target language code, or an empty string to keep the default language. Content fields such as title, excerpt, content, name, and description are translated, and link and permalink URLs are rewritten to the target language.
Use wzkb_trp_rest_translatable_keys to change which response fields are translated. The filter receives an array with content and url lists. The defaults are html, title, excerpt, content, name, and description for content, and link and permalink for URLs. The plugin leaves guid unchanged because it is an identifier.
Endpoints
- GET
/wzkb/v1/sections - GET
/wzkb/v1/knowledgebase - GET
/wzkb/v1/knowledgebase/{id} - GET
/wzkb/v1/products - GET
/wzkb/v1/search - GET
/wzkb/v1/related - POST
/wzkb/v1/ask(Pro)
GET /wzkb/v1/sections
Fetches Knowledge Base sections (wzkb_category terms) filtered by one or more product IDs, preserving parent/child relationships for hierarchical rendering.
| Parameter | Type | Required | Description |
|---|---|---|---|
products | string | yes | Comma-separated list of wzkb_product term IDs. Example: 173,178 |
Request example
Successful response
id: Section term ID.name: Section name.parent: Parent term ID (0 when top-level).product: Associated product ID pulled fromproduct_idterm meta (0 when unassigned).
Error responses
| HTTP Code | Error code | Reason |
|---|---|---|
| 400 | wzkb_rest_sections_disabled | Multi-product mode is disabled. |
| 401 / 403 | rest_forbidden | User lacks the capability granted via the wzkb_rest_route_permission filter. |
GET /wzkb/v1/knowledgebase
List published Knowledge Base posts with optional filtering.
| Parameter | Type | Required | Description |
|---|---|---|---|
per_page | int | no | Results per page (1–50). Default: 10. |
page | int | no | Page number. Default: 1. |
search | string | no | Free-text search term. |
product | int | no | Filter by wzkb_product term ID. |
section | int | no | Filter by wzkb_category term ID. |
Response
Headers: X-WP-Total (total posts) and X-WP-TotalPages.
GET /wzkb/v1/knowledgebase/{id}
Return a single Knowledge Base post including full content when published.
GET /wzkb/v1/products
List all Knowledge Base products.
GET /wzkb/v1/search
Lightweight search endpoint wrapping Knowledge Base queries.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | Search keywords (min 2 characters). |
product | int | no | Filter by product term ID. |
section | int | no | Filter by section term ID. |
limit | int | no | Results to return (1–50). Default: 10. |
limit applies only to this endpoint. The number of results on the knowledge base search results page is set separately with the wzkb_search_posts_per_page filter (default 12), which does not override limit:
GET /wzkb/v1/related
Fetch related articles for a given Knowledge Base post.
| Parameter | Type | Required | Description |
|---|---|---|---|
post_id | int | yes | Base Knowledge Base post ID. |
limit | int | no | Number of related items (1–20). |
POST /wzkb/v1/ask
Knowledge Base Pro 3.2.0 or later, on WordPress 7.0 or later, with Ask the Docs enabled. Answer a visitor’s question from the knowledge base using the connected AI provider.
| Parameter | Type | Required | Description |
|---|---|---|---|
question | string | yes | The question (3–300 characters). |
This route is meant for your site’s own pages. It refuses requests from other origins and from bots. See the Ask the Docs developer reference for the response fields, errors and filters.
Using the API in Gutenberg
The custom Gutenberg panel (includes/admin/js/editor-sections-panel.js) consumes /sections to show product-aware section lists. Other clients (mobile apps, headless front ends, internal tools) can consume the same endpoint, provided they authenticate and the site is running in multi-product mode.
Support
The above REST API is a preliminary implementation. If you notice any issue, have any usage questions or to suggest additional endpoints, please open a ticket.
