=== Knowledge Base ===
Contributors: Ajay, webberzone
Donate link: https://wzn.io/donate-wz
Tags: knowledge base, documentation, FAQ, support, wiki
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 3.1.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Build a multi-product knowledge base for WordPress. Reduce support tickets with self-service docs, FAQs, and a built-in help center.

== Description ==

[Knowledge Base](https://webberzone.com/plugins/knowledgebase/) makes building a knowledge base or FAQ for your WordPress site easy, fast, and scalable.

Whether you need a simple FAQ page, a full self-service help center, or a structured multi-product wiki, Knowledge Base scales to fit. Organize articles into products and sections, customize permalinks, and let your customers help themselves: no coding required.

Perfect for:

- Multi-product companies managing multiple help centers
- SaaS platforms with self-service documentation portals
- Ecommerce support centers reducing ticket volume
- Documentation hubs and internal company wikis
- Developers building customer-facing knowledge portals

[Live Demo](https://webberzone.com/support/knowledgebase/).

### Powerful features available in the Free version

- __Unlimited Knowledge Bases__: Support as many products as you like, with unlimited sections and sub-sections.
- __Beautiful, Responsive Layouts__: Ships with clean templates powered by the Responsive Grid System.
- __Customisable Permalinks__: View your KB at /knowledgebase/ by default or change the base slugs for articles, sections, products, and tags. Advanced custom permalink structures with dynamic placeholders are available in Pro.
- __Shortcodes + Gutenberg Blocks__: Add KB listings anywhere using [knowledgebase] or use the Knowledge Base block.
- __Built-in Breadcrumbs__: Improve UX and SEO with breadcrumb navigation.
- __Widgets Included__: WZKB Articles, WZKB Sections, WZKB Products, and WZKB Breadcrumbs widgets.
- __Built-in Caching__: Speed up your Knowledge Base without extra plugins. Configurable cache expiry settings are available in Pro.
- __Multilingual Ready__: Full WPML and Polylang compatibility — translate articles, sections, products, and tags; language-aware caching and widgets included out of the box.
- __Auto Table of Contents__: Automatically generate a linked Table of Contents from article headings, with configurable depth and minimum heading threshold.
- __Live Search Suggestions__: Show accessible AJAX search suggestions as visitors type in the Knowledge Base search form.
- __Related Articles__: Display related articles at the bottom of KB articles based on categories and tags.
- __Alerts__: Add attention-grabbing alert boxes with the [kbalert] shortcode or Alerts block.
- __Settings Export & Import__: Back up and restore all plugin settings as a JSON file. Sensitive values (API keys, webhook secrets) are automatically stripped on export and never overwritten on import.

### Pro features

[Knowledge Base Pro](https://webberzone.com/plugins/knowledgebase/#pro) enhances the plugin with advanced features for larger documentation sites, including ratings and feedback, a help widget, a powerful custom permalinks engine, premium layouts, enhanced TOC surfaces, and additional admin tools.

- __Article Rating & Feedback System__: Collect binary or 5-star feedback with optional follow-up questions, admin alerts, Bayesian sorting, and GDPR-friendly tracking modes.
- __Help Widget__: Offer an in-app support hub with live search, suggested articles, and a contact form inside a floating assistant.
- __Custom Permalinks Engine__: Craft advanced URL structures for articles, sections, tags, and products using dynamic placeholders.
- __Knowledge Base Homepage Mode__: Display the Knowledge Base on your site homepage. The Knowledge Base URL becomes the homepage and the Knowledge Base archive URL redirects to the homepage.
- __Premium Layout Pack__: Unlock seven additional frontend styles (Modern, Minimal, Boxed, Gradient, Compact, Magazine, Professional).
- __Enhanced Table of Contents__: Three Pro TOC delivery surfaces — a sidebar widget that renders the TOC for the current article, a Gutenberg block to insert the TOC inline, and a floating/sticky panel that follows the reader down the page.
- __Advanced Admin Tools__: Control knowledge base caching with expiry settings, on-demand cache clearing, and other productivity enhancements.
- __Documentation Layout Mode__: Transform any KB page into a three-column docs site with a sticky section-tree sidebar on the left, article content in the center, and an "On this page" TOC rail on the right. Collapsible accordion navigation adapts to the current product, section, or article automatically.
- __Section Tree Block & Widget__: Display a context-aware hierarchical navigation tree of your KB products, sections, and articles anywhere — as a Gutenberg block or a classic sidebar widget. The tree collapses and expands sections with an accessible accordion, and highlights the current page automatically.
- __GitHub Integration__: Sync markdown documentation from a GitHub repo. Push changes via webhooks and articles are created or updated automatically. YAML frontmatter controls slug, title, products, and sections.
- __Article Export & Import__: Export all Knowledge Base articles as a Markdown ZIP (with YAML frontmatter), a SQL INSERT dump, or an XLSX metadata spreadsheet. Re-import Markdown ZIPs to restore or migrate articles, with automatic taxonomy mapping and overwrite/skip control.

### Key Concepts

* __Articles:__ Custom post type `wz_knowledgebase`: your FAQs, how-to guides, and documentation.
* __Products:__ Custom taxonomy `wzkb_product`: link articles to one or more products.
* __Sections:__ Custom taxonomy `wzkb_category`: organize content neatly into categories.
* __Tags:__ Optional `wzkb_tag` taxonomy: make finding content even easier.

### Multilingual sites

Knowledge Base works with WPML, Polylang and TranslatePress. TranslatePress translates the knowledge base with the rest of the page, including REST responses, related articles, and live-search suggestions. No additional Knowledge Base configuration is needed for TranslatePress.

Rendered output and REST caches are separated by language, preventing cached content and links from being reused across languages.

### Contribute

If you have an idea, I'd love to hear it. WebberZone Knowledge Base is also available on [Github](https://github.com/WebberZone/knowledgebase). You can [create an issue on the Github page](https://github.com/WebberZone/knowledgebase/issues) or, better yet, fork the plugin, add a new feature and send me a pull request.

== Installation ==

### WordPress install (The easy way)

1. Navigate to “Plugins” within your WordPress Admin Area
2. Click “Add new” and in the search box enter “Knowledgebase” or "Knowledge Base"
3. Find the plugin in the list (usually the first result) and click “Install Now”
4. Activate or Network activate the Plugin in WP-Admin under the Plugins screen

### Manual install

1. Download the plugin
2. Extract the contents of knowledgebase.zip to wp-content/plugins/ folder. You should get a folder called knowledgebase.
3. Activate or Network activate the Plugin in WP-Admin under the Plugins screen

### Quick Start

When you Activate the plugin for the first time, you will be taken to the Setup Wizard. Follow the instructions to set up your knowledge base.

After the Setup Wizard, you can:

1. Go to __Knowledge Base &raquo; Products__: add your first Products if you've selected Multi-Product mode.
2. Go to __Knowledge Base &raquo; Sections__: add your first categories.
3. Go to __Knowledge Base &raquo; Add New__— create articles and assign them to sections.

__Want a multi-product Knowledge Base only with Sections?__

1. Set the *First section level* under the Output tab to 2
2. Create a set of top-level sections for each product
3. Create sub-sections for each of the products

See a live example: [WebberZone Knowledge Base Demo](https://webberzone.com/support/knowledgebase/).

== Frequently Asked Questions ==

If you don't see your question answered below, please post it on the [WordPress.org support forum](http://wordpress.org/support/plugin/knowledgebase). This is the quickest way to get help, as I check the forums daily. For more personalized assistance, I also offer [premium *paid* support via email](https://webberzone.com/support/).

= Why are Knowledge Base pages giving 404 errors? =

Flush permalinks! Go to __Settings > Permalinks__ and just click __Save Changes__.

= What shortcodes are available? =

Check the full shortcode guide here: [Knowledge Base Shortcodes](https://webberzone.com/support/knowledgebase/knowledge-base-shortcodes/).

= Can I override templates? =

Absolutely! Copy these files into your theme or `wp-content/knowledgebase/templates/`:

* `single-wz_knowledgebase.php`
* `archive-wz_knowledgebase.php`
* `taxonomy-wzkb_category.php`
* `wzkb-search.php`

Or .html versions if you are using a block theme.

= How do I change the article or section order? =

Use a plugin like [Intuitive Custom Post Order](https://wordpress.org/plugins/intuitive-custom-post-order/) to easily drag and drop posts, sections or tags to display them in a custom order.

= Can I use this as a help center or wiki? =

Yes! Knowledge Base works equally well as a help center, wiki, FAQ site, or documentation portal. Use sections to organize topics and products to separate different areas of your documentation.

= Does it support multiple products or projects? =

Yes. Enable Multi-Product mode via the Setup Wizard to organize articles under separate Products, each with their own sections and sub-sections.

= Is it compatible with page builders like Elementor or Divi? =

Yes. You can use the [knowledgebase] shortcode in any page builder. The plugin also provides Gutenberg blocks for block-based themes.

= Can visitors search the knowledge base? =

Yes. The plugin includes a built-in search form (via the [wzkb_search] shortcode and a Search block for Gutenberg) with optional live AJAX suggestions. You can enable or disable live search from the plugin settings. The Pro version also adds a floating Help Widget with live search and suggested articles.

= Is it compatible with WPML or Polylang? =

Yes. Knowledge Base has built-in support for both WPML and Polylang:

* **Articles, sections, products, and tags** are all translatable. WPML uses `wpml-config.xml` (bundled with the plugin) for automatic configuration. Polylang auto-detects the public post type and taxonomies.
* **Widgets** (Articles, Sections, Products) translate stored term IDs to the current language automatically, so you can save a term ID in the default language and the widget will display the correct translation.
* **Archive URLs** resolve to the language-aware URL via `get_post_type_archive_link()`, which both WPML and Polylang filter automatically.
* **Caching** is language-aware — cached output is keyed per language so visitors never see content from the wrong locale.

**Known limitations:**

* The Pro Custom Permalinks feature builds URL structures using `home_url()`. With WPML you may need to set the *Language URL format* to *Directory* (e.g. `/en/`, `/fr/`) for custom permalink structures to resolve correctly per language.
* The built-in search form posts to `home_url( '/' )` — this is the standard WordPress search pattern and is handled correctly by both plugins' URL routing.

= How can I report security bugs? =

You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/knowledgebase)

== Screenshots ==

1. Knowledge Base Menu in the WordPress Admin
2. Knowledge Base Viewer Facing with Default styles
3. Knowledge Base alerts
4. Settings &raquo; General
5. Settings &raquo; Output
6. Settings &raquo; Styles
7. Knowledge Base widgets

== Changelog ==

= 3.1.5 =

Release date: 24 September 2026

**Added**

* Added TranslatePress support for Knowledge Base REST responses, search results and related articles.

**Changed**

* Improved accessibility of the settings screens.
* [Pro] The GitHub importer now accepts `heading_depth` and `min_headings` in `[toc]` markers, and exports keep complex tables as HTML.
* Blank product, section and tag slugs now fall back to their defaults, and a blank Knowledge Base slug with a blank article permalink structure places articles at the site root.

**Security**

* Hardened the escaping of thumbnail width and height attributes.

**Fixed**

* [Pro] Custom article permalink structures made regular posts show the blog index and could capture page, tag and pagination URLs.
* [Pro] Custom permalinks returned 404s or were ignored for blank Knowledge Base slugs, articles missing a term, term feeds and pagination, and structures such as `docs/%postname%`.
* Feeds showed the wrong content when the Knowledge Base slug was blank.
* Cached Knowledge Base output and REST responses could serve content from another language on multilingual sites.
* Fixed PHP 8.6 deprecation notices.

= 3.1.4 =

Release date: 5 September 2026

**Added**

* [Pro] Added the `%product_id%` placeholder for product, section, and article permalink structures. Product and section IDs resolve to their corresponding taxonomy terms, including hierarchical sections.

**Changed**

* [Pro] Invalid product and section IDs now return a 404 response instead of falling back to another Knowledge Base archive.

**Fixed**

* Fixed plugin data being deleted when uninstalling one version while its paired free or Pro counterpart was active.
* [Pro] Fixed the `%section_id%` placeholder generating the wrong query variable, which caused section URLs to load the wrong archive or return a 404.
* [Pro] Fixed custom permalink settings using stale rewrite rules immediately after they were saved. Rewrite rules now flush after the new settings have been registered.

= 3.1.3 =

Release date: 26 August 2026

**Changed**

* [Pro] GitHub commit messages generated when pushing articles are now prefixed with `docs: ` so they follow conventional commit style in the target repository.
* [Pro] The GitHub importer now skips Markdown files that have no frontmatter, and files whose frontmatter sets `kb_exclude: true`. An article that was imported earlier and is later marked `kb_exclude` is drafted or deleted according to the mapping's "When a File is Deleted" setting. Excluded files are reported in the import wizard results and counted separately.
* [Pro] GitHub bulk exports now use Git Trees content uploads, prepare bounded chunks with progressive table updates, create one commit per repository and branch, and resume safely after an interruption.
* [Pro] A GitHub export now resumes automatically when the wizard page is reloaded while an export is still running.
* [Pro] The GitHub import and export results tables now show a Product column, so you can see which product each article belongs to.
* Updated the Settings API framework, Options API and admin notices API to their latest versions.
* PHP compatibility checks now cover PHP 7.4 to 8.6.
* Updated npm dependencies.

**Fixed**

* Fixed checkbox settings resolving to `true`/`false` instead of `1`/`0` when read before their saved value existed, which could break blocks and REST responses that expect a numeric value.
* Fixed `Custom CSS` returning `false` instead of an empty string when no value had been saved.
* Fixed the `wzkb_settings_defaults` filter being ignored when a default was read outside the admin area.
* Fixed settings on a multisite network reading another site's values in the same request after a `switch_to_blog()` call, such as during network activation.
* Fixed the settings wizard silently dropping repeater field rows on save.
* [Pro] Fixed the GitHub export wizard preview using post timestamps instead of generated Markdown, which could omit articles that were later pushed.
* [Pro] Fixed empty article exports from being hashed or sent to GitHub.
* [Pro] Fixed the GitHub exporter attempting to push articles whose post no longer exists; such articles are now reported in the results table and the rest of the export continues.
* [Pro] Fixed the GitHub exporter writing documented shortcodes as literal text, so re-importing an article executed them — a heading reading `[bsearch_form]` came back as a working search form. Literal shortcodes are now written in the `[[shortcode]]` form, which WordPress renders as text and which survives the round trip. Only registered shortcode tags are escaped, so WP-CLI notation such as `[--force]` and placeholders such as `wzkb_rated_[article_id]` are left untouched.
* [Pro] Fixed the GitHub exporter dropping `order: 0` from the frontmatter, which made push-back non-idempotent and produced a diff against the repository even when nothing about the article had changed.

= 3.1.2 =

Release date: 16 August 2026

**Changed**

* Updated the Settings API framework.

**Fixed**

* Fixed a fatal error ("There has been a critical error on this website") that could occur when Pro features were activated — e.g. on starting a free trial or activating a license — on sites whose saved settings predate the floating table of contents option.
* Fixed a fatal error when Knowledge Base and Knowledge Base Pro were activated together by namespacing the function-existence guard for the main instance and guarding the autoloader and settings includes.
* Fixed the Settings page sidebar overlapping the tab content by switching the post body layout to flexbox.
* Fixed disabled and Pro-gated settings losing their stored values on save when their field was not submitted.

= 3.1.1 =

Release date: 21 July 2026

**Added**

* Added search to the Settings page to quickly find options across tabs.

**Changed**

* Smooth scroll-to-top when switching Settings tabs.
* Updated Settings API to 2.10.1 and refreshed the admin banner.
* Updated Freemius SDK to 2.13.4.
* Updated WordPress.org banner images.

**Fixed**

* Fixed default-value label lookup for select/radio fields that use an empty string as a real option key (e.g. "Do not display").
* [Pro] GitHub/Markdown exporter: unknown block types without inner blocks now export raw innerHTML instead of a block comment, so they round-trip correctly on re-import.
* [Pro] GitHub/Markdown exporter: pass `<mark>`, `<u>`, `<sub>`, `<sup>` through as raw HTML during inline conversion, and allow `future` as a valid frontmatter/mapping post status.
* [Pro] GitHub/Markdown exporter: emit the `toc: true` frontmatter flag when an article contains a TOC block, for full importer/exporter parity.

= 3.1.0 =

Release date: 9 July 2026
Release post: https://webberzone.com/announcements/knowledge-base-v3-1-0/

**Added**

* [Pro] Documentation Layout Mode: three-column docs site layout with a sticky, collapsible section-tree sidebar, article content area, and on-this-page TOC rail. Enable via Settings → Pro. Works on all KB page types (home, product, section, single article, search).
* [Pro] Section Tree block (`knowledgebase/section-tree`) and sidebar widget: context-aware hierarchical navigation tree displaying products, sections, and articles with collapsible accordion and active-item highlighting. Adapts automatically to the current product, section, or article page.
* [Pro] GitHub Integration: sync markdown documentation between GitHub repositories and the Knowledge Base via webhooks, with YAML frontmatter, markdown-to-Gutenberg conversion, and HMAC signature verification. Import and export are combined into a single Importer/Exporter page, with featured image support and a post-import next-actions panel.
* [Pro] Article Export & Import: export articles as a Markdown ZIP, SQL dump, or XLSX spreadsheet, and re-import Markdown ZIPs (matched by slug) to restore or migrate.
* [Pro] Term featured image support for product and section archives.
* Plugin Importer: migrate articles, sections, products, and tags from BasePress, BetterDocs, and Echo KB.
* Settings Export & Import: back up and restore plugin settings as JSON, with sensitive keys preserved on the existing site.
* Sample content: import demo articles, sections, and products from the Setup Wizard or Tools page, removable in one click.
* Added `wzkb_tag` taxonomy templates, displaying tag terms on single articles and tag archives.

**Changed**

* [Pro] Floating TOC now slides in horizontally from the viewport edge instead of collapsing vertically.
* Reorganized admin navigation and added a Settings button to the admin banner.
* Upgraded Tom Select to v2.6.1.

= Earlier versions =

For the changelog of earlier versions, please refer to the [releases page on GitHub](https://github.com/WebberZone/knowledgebase/releases).

== Upgrade Notice ==

= 3.1.5 =
Security release. Hardens thumbnail attribute escaping, fixes Knowledge Base permalinks with blank or custom slugs, including custom structures capturing post and page URLs, and fixes multilingual caching. Update recommended.
