WPBot Core hooks and functions

On this page

WPBot Core holds the services every WPBot tool shares. Its hooks start with qcld_wpbot_core/. Hooks that only connect WPBot's own modules and screens (admin design, host registration, social logins) are left out here.

Knowledge base

The knowledge base is what the chatbot and other AI features search before they answer. Posts follow edits on their own: saved, unpublished and deleted posts are updated right away, and their vectors follow in the background. WooCommerce products are synced again when their price or stock changes.

HookTypeParametersWhat it is for
qcld_wpbot_core/kb_post_typesfilterstring[] $typesPost types the knowledge base reads (the owner's choice in AI / Settings → Knowledge Base)
qcld_wpbot_core/kb_post_textfilterstring $text, WP_Post $postThe text stored for one post: add custom fields, product data or remove boilerplate
qcld_wpbot_core/kb_post_accessfilterstring[] $labels, WP_Post $postAccess labels of a post: public, logged_in, role:*, membership:*, course:*, purchased:*; empty = everyone
qcld_wpbot_core/kb_sourcesfilterarray $sourcesAdd a source that is not a post type: id => [ label, count, items ]
qcld_wpbot_core/kb_search_argsfilterarray $args, string $queryChange a search before it runs: types, exclude_types, weights per source
qcld_wpbot_core/kb_pre_searchfilternull, string $query, array $argsReturn your own results to answer a search elsewhere; null searches as usual
qcld_wpbot_core/kb_resync_meta_keysfilterstring[] $keysPost meta keys whose change syncs the post again (default _price, _regular_price, _sale_price, _stock_status, _stock)
qcld_wpbot_core/kb_scan_limitfilterint $limitRecent pieces scored by vector besides full-text hits (default 2000)
qcld_wpbot_core/kb_item_storedactionstring $source, array $itemAn item was stored with new content
qcld_wpbot_core/kb_item_removedactionstring $source, string $idAn item left the knowledge base
qcld_wpbot_core/kb_emptiedactionint $removedThe whole knowledge base was emptied

Knowledge base functions

FunctionWhat it does
qcld_wpbot_core_kb_search( $query, $args )Search the knowledge base. $args: top_k, min_score, types, exclude_types, weights, labels (the visitor's access labels; omitted = public only). Each result has title, url, content, score, source_type, source_id, heading_path, anchor.
qcld_wpbot_core_kb_context( $query, $args )The same search as ready-to-use prompt text
qcld_wpbot_core_kb_store( $source, $item )Store or update one item: id, title, url, content, optional language, access, html, modified
qcld_wpbot_core_kb_remove( $source, $id )Remove one item
qcld_wpbot_core_kb_set_access( $source, $id, $labels )Change who may see an item
qcld_wpbot_core_kb_type_stats( $type )Items, pieces, ready, pending and errors of a source

Examples are in Feed your own data to the chatbot's knowledge base.

AI providers and keys

HookTypeParametersWhat it is for
qcld_wpbot_core/ai_providersfilterarray $providersThe provider and model catalogue with prices used for cost estimates
qcld_wpbot_core/route_modelfilterstring $model, string $provider, array $context (module, feature, question)Choose another model for one request; return the model id
qcld_wpbot_core/fallback_providerfilterstring $fallback, string $provider, WP_Error $error, array $contextThe provider id to try when a provider failed; '' for none
qcld_wpbot_core/model_price_feedfilterbool $onReturn false to stop the weekly download of current model prices from OpenRouter's public model list
qcld_wpbot_core/rejected_key_ttlfilterint $secondsHow long a key the provider rejected is not sent again (default six hours)
qcld_wpbot_core/key_status_changedactionstring $module, string $provider, string $causeA key started or stopped failing. $cause is one of invalid_key, no_credit, rate_limit, model_removed, no_key, key_unreadable (or empty when it works again)

Encryption key: API keys are stored encrypted with your site's salts. Define QCLD_WPBOT_CORE_KEY in wp-config.php to use your own encryption key instead. If you change the salts or this constant later, saved keys can no longer be read and must be pasted again.

AI spending

Every AI call is checked against the owner's limits and recorded. All figures are estimates. See Set AI spending limits and alerts.

HookTypeParametersWhat it is for
qcld_wpbot_core/spend_recordedactionarray $rowOne AI call was recorded (no prompt or answer text)
qcld_wpbot_core/spend_limit_reachedaction$scope, $reason, $module, $featureA limit stopped a call; once per scope and request
qcld_wpbot_core/spend_settings_savedaction–The owner saved Spending and limits
qcld_wpbot_core/spend_alert_recipientsfilterstring[] $emails, array $settingsWho receives spending alerts
qcld_wpbot_core/spend_capabilityfilterstring $capCapability for the spending screens and routes (default manage_options)
qcld_wpbot_core/spend_pricesfilterarray $pricesPrices that are not per token (images, speech, web searches)
qcld_wpbot_core/spend_hourlyaction–Hourly spending check
qcld_wpbot_core/spend_weeklyaction–Once a week, on the owner's weekday

If your own plugin calls an AI provider on WPBot's behalf, meter it with qcld_wpbot_core_spend_allow( $module, $feature, $estimate ) (returns true or a WP_Error when a limit is reached) and qcld_wpbot_core_spend_record( $module, $feature, $usage, $meta ), or wrap the call in qcld_wpbot_core_spend_wrap( $module, $feature, $callable, $meta ).

Background jobs

Bulk work (knowledge base syncs, AI Writer batches and similar) runs as jobs on WP-Cron, every five minutes and right after a job is queued.

HookTypeParametersWhat it is for
qcld_wpbot_core/job_doneactionarray $jobA job finished
qcld_wpbot_core/job_handlersfilterarray $handlersStep kind => callable, for modules that add job steps

The WP-Cron event is qcld_wpbot_core_run_jobs. See Background jobs, digests and scheduled tasks do not run (WP-Cron).

Error log

Hook / functionTypeParametersWhat it is for
qcld_wpbot_core_log_error( $source, $message, $detail )function–Add your own entry to WPBot's error log; returns whether it was stored
qcld_wpbot_core/error_log_enabledfilterbool $onForce the error log on or off, whatever the owner chose
qcld_wpbot_core/error_log_outsidefilterbool $onWhether errors from other plugins, the theme and WordPress are recorded

See Error log and support reports.

Notification emails

HookTypeParametersWhat it is for
qcld_wpbot_core/notification_emailsfilterstring[] $emails, bool $savedThe addresses WPBot's staff emails go to
qcld_wpbot_core/notification_default_emailsfilterstring[] $emailsAddresses suggested on AI / Settings → Notifications
qcld_wpbot_core/route_notificationfilterbool $route, array $mailReturn false to keep one WPBot email out of the notification list routing

The function qcld_wpbot_core_notification_emails() returns the current list. Emails to visitors and customers are never routed. Two more filters decide each email's timing: qcld_wpbot_notification_classify (which notification an email is) and qcld_wpbot_notification_decision (instant, daily, weekly or off). See Notification emails and digests.

Branding

qcld_wpbot_core/brand (filter, array $brand) holds the product name, logo, URL and colours that WPBot's screens show. White Label sets the same values from the admin; see White Label: your own name and logo.

Availability

In every edition, including WPBot Free. The spending report sections by channel and provider, spike alerts and the weekly summary email are added by WPBot Pro Professional and Master.

Got more questions?

Contact our ChatBot Support Heroes. They’ll provide you with all the information you need.

Contact us

Customer support is very responsive and professional. The script is awesome and with many features, including A.I. from Dialogflow. High quality.

Newpolaris

If have a 7 Stars won’t hesitate to rate that chatbot as a 7stars+++ Very helpful prompt team support Cannot find enough words express my happiness for purchasing that CHATBot Good Luck for you and your items

Ahsmartsolutions

© 2002- 2026 QuantumCloud

Black Friday! Use coupon code monster for a discount during checkout!

DISCOUNT!

X
Let's chat if you need any help finding the right product or need support.
FAQSend Us Email