Recent

BetterDocs_Importerclass

BetterDocs_Importer

Imports content from the BetterDocs plugin.

CPT: docs | Taxonomies: doc_category → wzkb_category, doc_tag → wzkb_tag Multiple Knowledge Base (Pro): knowledge_base → wzkb_product. Docs are assigned directly to knowledge_base terms; categories carry a doc_category_knowledge_base term meta listing the KB slugs they belong to.

Base slug: betterdocs_settings[‘docs_slug’] or docs_page slug when BetterDocs uses a custom docs page. Article URL: controlled by betterdocs_settings[‘permalink_structure’] (the parent path), enable_category_hierarchy_slugs, and the article slug. Reactions (happy/sad) and impressions live in the {prefix}betterdocs_analytics table and are mapped to WZ KB binary rating + view-count meta.

Namespace: WebberZone\Knowledge_Base\Admin\Importers
Since: 3.1.0
Source: includes/admin/importers/class-betterdocs-importer.php line 32 Extends: Base_Importer

Methods

get_label()

{@inheritDoc}

Line: 144

public function get_label(  ): string;

Returns: string

get_slug()

{@inheritDoc}

Line: 151

public function get_slug(  ): string;

Returns: string

get_source_settings()

{@inheritDoc}

Line: 166

public function get_source_settings(  ): array;

Returns: array

get_post_count()

{@inheritDoc}

Line: 195

public function get_post_count(  ): int;

Returns: int

get_term_count()

{@inheritDoc}

Line: 210

public function get_term_count(  ): int;

Returns: int

import_terms()

{@inheritDoc}

Three passes:

  1. knowledge_base terms → wzkb_product (Multiple KB mode only).
  2. doc_category (hierarchical) → wzkb_category, with product_id meta resolved from the category’s doc_category_knowledge_base slug list.
  3. doc_tag (flat) → wzkb_tag.

Line: 239

public function import_terms(  ): array;

Returns: array

import_posts_batch()

{@inheritDoc}

Also resolves BetterDocs _docs_order term meta to set menu_order, maps the Multiple KB assignment to wzkb_product, and migrates reactions/view counts.

Line: 432

public function import_posts_batch( int $offset, int $batch_size ): array;
Type Name Description
int $offset Pagination offset.
int $batch_size Number of posts to process.

Returns: array

finalize_import()

{@inheritDoc}

  • Optionally sets kb_slug to match the BetterDocs docs base path.
  • Optionally replaces the docs page content with the [knowledgebase] shortcode so it renders the KB at the original URL.
  • Enables multi-product mode automatically when two or more KBs were imported.
  • Sets article_permalink (Pro) to preserve article URLs after deactivation.

Since: 3.1.0
Line: 528

public function finalize_import( bool $update_slug = ... ): void;
Type Name Description
bool $update_slug Whether the user opted to update the KB slug and docs page.

Returns: void

get_before_import_notices()

{@inheritDoc}

Line: 598

public function get_before_import_notices(  ): array;

Returns: array

get_preview_data()

{@inheritDoc}

Extends the base preview with products, categories, tags, reactions, views, docs page detail, and structured taxonomy/meta/settings mapping sections.

Since: 3.1.0
Line: 1004

public function get_preview_data(  ): array;

Returns: array