kimaai_chatbot_content_awareness_post_types

When it fires

While the chatbot’s instructions are built (kimaai_chatbot_instructions, priority 10), when the content awareness is on and the chat sits on a single post or page that exists. The setting lists the public post types of the site’s search, plus posts and pages; this filter adds a post type it does not list, such as one left out of the search, or removes one for some pages.

When the page’s post type is among the returned keys, the content awareness fills {post_url}, {post_title}, {post_content} and {post_section} with it; otherwise they stay empty. The filter cannot open a page the visitor may not see: drafts, password-protected and members-only pages stay out afterwards.

Parameters

NameTypeDescription
post_typesarrayThe post types of the content awareness setting, slug => label.
post_idintThe ID of the page the visitor is on.
postWP_PostThat page.
instructionsstringThe chatbot’s instructions so far, with their placeholders.

Returns

array: The allowed post types; only the keys count.

Example

add_filter(
  'kimaai_chatbot_content_awareness_post_types',
  function (array $post_types, int $post_id, WP_Post $post, string $instructions): array {
    // FAQ entries are left out of the site search, so the setting does not list them.
    $post_types['faq'] = 'FAQ';

    return $post_types;
  },
  10,
  4
);
  • kimaai_chatbot_instructions: changes the instructions the page is described in.

What are your feelings