apply_filters( 'relevanssi_index_titles', bool $index, WP_Post $post_object )

Controls whether post titles are indexed or not.


(bool) If true, index post titles. Default true.

(WP_Post) The post object.

More information

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

add_filter( 'relevanssi_index_titles', '__return_false' );

This will short-circuit the post title indexing. Make sure you rebuild the index after adding the line.

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

You can also use the second parameter, introduced in version 2.24.1, to control which posts get the titles and which not.