relevanssi_render_blocks

apply_filters( 'relevanssi_render_blocks', boolean $render, object $post )

Filters whether Relevanssi renders the Gutenberg blocks or not.

Parameters

$render
(boolean) If true, render the blocks. Default true.

$post
(object) The post object.

More information

When Relevanssi indexes posts with Gutenberg blocks, the blocks are rendered before Relevanssi processes the post so that Relevanssi can index the full block content as users see it. You can use this filter hook to adjust that: if it returns false for a post, Relevanssi will not render the blocks in that post, and Relevanssi sees the post as it is.

This hook is primarily a performance tool: rendering the blocks in an extensive post will make the indexing painfully slow or even crash. By skipping the post, you can avoid these problems. Here’s how you can stop Relevanssi from rendering the blocks in post 27, for example:

add_filter( 'relevanssi_render_blocks', function( $render, $_post ) {
  if ( 27 === $_post->ID ) {
    $render = false;
  }
  return $render;
}, 10, 2 );