---
name: kimaai_embedding_remove_node_class_sets
type: filter
since: 1.4.2
tier: premium
feature: embeddings
area: embedding-search
summary: Removes elements with given classes from a post's HTML before it is indexed, such as a theme's related posts box.
parameters:
  - name: class_sets
    type: array
    description: Sets of class names; each set is a list of classes or one string of classes separated by spaces or dots. None by default.
returns:
  type: array
  description: The class sets.
---

# kimaai_embedding_remove_node_class_sets

## When it fires

In every sync of the knowledge base, each time KimaAI turns cleaned HTML into text: once for a post's rendered content, and once per block when the fallback extractor walks a post's blocks. It has no post argument and applies to every post; use the classes the theme and plugins put on the boxes you want gone. PDFs do not pass it.

An element is removed with everything inside it when it has every class of one set: `['related-posts']` removes each element with the class `related-posts`, `['banner', 'newsletter']` only elements that have both classes. The string `'banner newsletter'` (or `'.banner.newsletter'`) is the same set. Scripts, styles, forms, buttons and iframes are removed before, without this filter.

## Example

```php
add_filter(
  'kimaai_embedding_remove_node_class_sets',
  function (array $class_sets): array {
    // The theme's related posts box and its newsletter banner are on every post: they are not its content.
    $class_sets[] = ['related-posts'];
    $class_sets[] = ['banner', 'newsletter'];

    return $class_sets;
  }
);
```

## Related

- `kimaai_embedding_shortcode_blocklist`: keeps a shortcode's output out before the HTML is rendered.
- `kimaai_embedding_render_mode`: renders without the_content, so boxes other plugins add there never appear.
