---
name: kimaai_chatbot_should_load
type: filter
since: 1.4.2
tier: free
feature: chatbot
area: chatbot
summary: Switches the floating chat off on chosen pages, or on where the setting leaves it off.
parameters:
  - name: enabled
    type: bool
    description: Whether the setting shows the floating chat on every page.
returns:
  type: bool
  description: Whether the floating chat loads on this page.
---

# 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.

## Example

```php
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;
  }
);
```

## Related

- `kimaai_chatbot_theme_vars`: the floating chat's colours.
