kimaai_chatbot_should_load

When it fires

On every front-end page, when WordPress enqueues the scripts (wp_enqueue_scripts), and again where a shortcode or block places a floating chat. The conditional tags such as is_page() and is_singular() work there. true loads the widget’s script and style and prints the floating chat in the footer; false leaves both out, unless a shortcode or block on the page needs the script.

The filter decides only on the floating chat that the settings put on every page. A chat placed with the [kimaai_chatbot] shortcode or the KimaAI chat block still shows, and a floating chat placed that way prints when the filter returns false. Return true to show the floating chat on chosen pages while the setting is off.

Parameters

NameTypeDescription
enabledboolWhether the setting shows the floating chat on every page.

Returns

bool: Whether the floating chat loads on this page.

Example

add_filter(
  'kimaai_chatbot_should_load',
  function (bool $enabled): bool {
    // No floating chat on the cart and the checkout.
    if (is_page(['cart', 'checkout'])) {
      return false;
    }

    return $enabled;
  }
);
  • kimaai_chatbot_theme_vars: the floating chat’s colours.

What are your feelings