relevanssi_index_content

apply_filters( 'relevanssi_index_content', bool $index )

Controls whether post content is indexed or not.

Parameters

$index
(bool) If true, index post content. Default true.

More information

If you don’t want to include the post content in the search at all, the best way to stop that is using this filter hook by adding this line to your theme functions.php:

add_filter( 'relevanssi_index_content', '__return_false' );

This will short circuit the content indexing. Make sure you rebuild the index after adding the line. This will make indexing much faster, the index a lot leaner, and the search faster – but of course, with the price of losing the post content. But sometimes, that makes sense, and in those cases, this is the best way to stop Relevanssi from indexing the post content.

If you do that, you can also add this to stop content from being used in excerpts:

add_filter( 'relevanssi_pre_excerpt_content', '__return_empty_string' );

If you want to exclude post titles from the index, use relevanssi_index_titles for that. If you want to block content from some posts selectively, you can use relevanssi_post_content and return an empty string for the posts where you don’t want the content indexed.