Skip to content

Commit

Permalink
Merge pull request #3681 from 10up/filter_to_set_number_of_fragments_…
Browse files Browse the repository at this point in the history
…3579

Filter to set number of fragments 3579
  • Loading branch information
felipeelia authored Oct 4, 2023
2 parents 96e1cca + e4b0d9e commit a0a058d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion includes/classes/Feature/Search/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,16 @@ public function add_search_highlight_tags( $formatted_args, $args ) {
'pre_tags' => [ $opening_tag ],
'post_tags' => [ $closing_tag ],
'type' => 'plain',
'number_of_fragments' => 0,
/**
* Filter the maximum number of fragments highlighted for a searched field.
*
* @since 4.7.2
* @hook ep_highlight_number_of_fragments
* @param {int} $max_fragments Maximum number of fragments for field.
* @param {string} $field Search field being setup.
* @return {int} New maximum number of fragments to highlight for the searched field.
*/
'number_of_fragments' => apply_filters( 'ep_highlight_number_of_fragments', 0, $field ),
];
}

Expand Down

0 comments on commit a0a058d

Please sign in to comment.