Developers

Shortcode reference

Every Promptor shortcode and the Promptor Chat block, their context attribute, per-knowledge-base variants and use in templates and page builders.

Promptor displays its inline chat with a shortcode or, since 2.1.0, with the Promptor Chat block. This page lists every shortcode the plugin registers in version 2.1.0, the block's attributes, and how each behaves. For step-by-step guides aimed at site owners, see Add the chat to your site and Add the chat with the Gutenberg block.

Shortcodes

ShortcodeAttributesNotes
[promptor_search]contextThe primary, documented shortcode.
[promptor]contextAlias of [promptor_search].
[promptor_results]contextAlias of [promptor_search].
[promptor_<key>]noneGenerated for every knowledge base, with context preset to <key>.
[promptor_search_<key>]noneSame, generated for every knowledge base.
[promptor_results_<key>]noneSame, generated for every knowledge base.

<key> is the knowledge base's short name (key), shown on its card in Knowledge Bases › Manage.

The context attribute

context is the only attribute. It selects which knowledge base the chat answers from.

ValueResult
omittedUses the default knowledge base.
an existing key, e.g. salesUses that knowledge base.
a key that does not existThe shortcode outputs nothing. No error is shown.
[promptor_search]
[promptor_search context="sales"]
[promptor_sales]

The last two lines are equivalent.

The free version has one knowledge base (default), so context matters only with Pro, where you can create more. Compare plans.

Knowledge base keys contain only lowercase letters, digits, hyphens and underscores.

Appearance per shortcode

  • Colours, texts and other UI settings come from the knowledge base's own UI settings if they exist (Pro, set with UI Customization Target in Settings › UI Settings), otherwise from the global UI settings.
  • Widget theme (Light, Dark, Auto) is always taken from the global settings.
  • Size: the inline wrapper is 75vh tall, at least 500 px and at most 800 px. Its width follows the container.
  • CSS isolation: the wrapper resets inherited styles (all: initial) and uses CSS containment, so theme styles do not leak in.
  • Branding: "Powered by Promptor" is shown unless the site runs Pro.

There are no attributes for size, colour or title. Use Settings › UI Settings, or the promptor/public/ui_settings filter (see Hooks and filters).

The Promptor Chat block

The block editor has a Promptor Chat block (in the Widgets category; search for "chat", "ai", "assistant", "promptor" or "chatbot"). It is a dynamic block: WordPress renders it on the server through the same code as [promptor_search], so the block and the shortcode produce identical chat markup. It works in both the free and the Pro edition.

PropertyValue
Block namepromptor/chat
Attributecontext (string, default default): the knowledge base key
SidebarKnowledge base panel with an Answer from dropdown listing your knowledge bases by name
AlignmentWide and Full
Per pageOne Promptor Chat block per post or page (multiple: false)
HTML editingNot available (the block has no static HTML)
Editor previewA live, non-clickable preview of the chat rendered by the server

The block's markup in the post content looks like this:

<!-- wp:promptor/chat {"context":"sales"} /-->

When context is default, WordPress leaves it out:

<!-- wp:promptor/chat /-->

Differences from the shortcode:

  • Unknown knowledge base: if context names a knowledge base that no longer exists, the block falls back to the default knowledge base instead of showing nothing. (A shortcode with an unknown context outputs nothing.)
  • Nothing to show: if the chat cannot be rendered at all, the block outputs nothing on the page, and the editor shows "No knowledge base matches this selection yet. Create one under Promptor → Knowledge Bases."
  • Assets: the block loads Promptor's scripts and inline settings when it renders, so it also works in block-based templates and template parts.

Use in PHP templates

<?php echo do_shortcode( '[promptor_search context="support"]' ); ?>

Promptor normally loads its CSS and JavaScript only on posts whose content contains a Promptor shortcode. When the shortcode is rendered elsewhere (a template, a widget, a page builder module), Promptor loads its assets at render time, so do_shortcode() works anywhere in the page.

Use in page builders

In the block editor, use the Promptor Chat block. In other page builders, use the builder's shortcode element and paste the shortcode. Give the element enough height: at least 500 px.

Several chats on one page

Each shortcode renders its own chat with its own knowledge base. You can combine one Promptor Chat block with shortcodes on the same page. Conversation history is stored per knowledge base in the visitor's browser (sessionStorage key promptor_chat_v1_<context>), so two chats with different contexts keep separate histories.

The popup is not a shortcode

The Pro floating popup is turned on in Settings › UI Settings with Chat Position and uses the knowledge base set in Knowledge Base for Popup. It is rendered in the footer of every page and needs no shortcode. See Show the chat as a floating popup.

Still need help?

Our support team answers every ticket. Tell us your WordPress version, Promptor version and what you see.

Read the FAQSee what changed in each version

Open a support ticket

All help topics