wpfts_se_titletext (Filter)

The wpfts_se_titletext filter in WP Fast Total Search allows developers to modify the post title text displayed in search results when using the Smart Excerpts functionality. This provides the ability to add, modify, or remove information from the title, such as adding file extensions for attachments, changing the text case, or adding prefixes/suffixes.

When Used

  • Adding File Type Information: For attachments, you can add the file extension to the title so users can immediately see what type of file they are opening.
  • Modifying Title Text: You can change the case of the text, add prefixes/suffixes to it, or perform other transformations.
  • Adding Icons or Other Elements: You can add HTML code to display icons or other elements next to the title.

Arguments

  • $r1 (array): An array of data containing information about the title. Includes the following keys:
    • is_demo (bool): A flag for demo mode.
    • is_attachment (bool): A flag indicating whether the post is an attachment.
    • is_file_ext (bool): A flag indicating whether to display the file extension for attachments.
    • title (string): The title text.
  • $post (array): An array of post data.

Return Value

  • $r1 (array): The modified title data array. Changes should be made to the title key.

Example (Adding a Prefix to the Title)

add_filter('wpfts_se_titletext', 'add_prefix_to_title', 10, 2);
 
function add_prefix_to_title($r1, $post)
{
	$r1['title'] = '[Prefix] ' . $r1['title'];
	return $r1;
}

Important Notes

  • The wpfts_se_titletext filter is called only when using Smart Excerpts.
  • Changes made to the title text will be displayed in the search results.

This filter gives developers the ability to flexibly customize the display of post titles in WP Fast Total Search search results.