---
name: kimaai_embedding_render_mode
type: filter
since: 1.4.2
tier: premium
feature: embeddings
area: embedding-search
summary: Chooses whether a post is rendered through the_content or from its blocks and shortcodes only before it is indexed.
parameters:
  - name: mode
    type: string
    description: the_content by default. Any other value renders the raw content with do_blocks() and do_shortcode() only.
  - name: post
    type: WP_Post|null
    description: The post being prepared for the knowledge base.
  - name: raw
    type: string
    description: The post's raw content (post_content).
returns:
  type: string
  description: the_content, or another value such as blocks.
---

# kimaai_embedding_render_mode

## When it fires

Once per post in every sync of the knowledge base (the Sync tab, the automatic sync when a post is published or updated, `wp kimaai vectors sync` and the MCP re-embed tool), when its content is rendered to HTML. PDFs are read from the file instead and do not pass it.

With `the_content`, the default, KimaAI sets the post up as the global post and runs its content through WordPress's `the_content` filter, as the page would: blocks, shortcodes and everything other plugins and the theme add there, such as share buttons or a related posts box. Any other value renders the raw content with `do_blocks()` and `do_shortcode()` only, without the `the_content` filter. A page builder that builds its output in `the_content` needs the default.

The HTML is cleaned (scripts, forms and the like removed) and turned into text after this. When a post's text changes, its next sync embeds the changed chunks again.

## Example

```php
add_filter(
  'kimaai_embedding_render_mode',
  function (string $mode, ?WP_Post $post): string {
    // Landing pages get sign-up boxes from other plugins through the_content: index only their own blocks.
    if ($post instanceof WP_Post && $post->post_type === 'landing_page') {
      return 'blocks';
    }

    return $mode;
  },
  10,
  2
);
```

## Related

- `kimaai_embedding_shortcode_blocklist`: keeps a shortcode's output out in either mode.
- `kimaai_embedding_remove_node_class_sets`: removes elements of the rendered HTML by class.
