add_filter ( 'wpfts_index_post', function(Array $index, WP_Object $post){ 
    ... your code ... 
}, 10, 2);

Allows you to manage the data set to be indexed.


(Array) A set of strings, which will be placed on the search index. Keys are cluster names, values are texts.

(WP_Object) The object of WP post record (post, page, custom post) which is being processed in this call.


The WPFTS plugin calls this filter hook just before making changes in the search index for the particular record (post, page, custom post, etc). The array value $index contains a set of strings that will be stored in the search index.

The keys of the $index represent search clusters, while values contain the textual data which will be stored in these clusters.

By default, the input $index contains two elements:

  • post_title contains the value of the post title (taken directly from the post_title column of the database record);
  • post_content contains the value of the post_content column of the wp_posts database.

You are free to append these values by any string data or you can add more clusters to the $index array. However, keep in mind, having too many different clusters will increase the complexity of the logic for the search engine and this may cause a performance decrease. Normally, it’s ok to have not more than 10 different clusters. Most of the search applications require 4-6 clusters.



3 1 vote
Article Rating
This entry was posted in . Bookmark the permalink.
Notify of
Inline Feedbacks
View all comments