relevanssi_clean_excerpt

apply_filters( 'relevanssi_clean_excerpt', string $content, string $start_emp_token, string $end_emp_token )

Filters the highlighted excerpt before the highlighting tokens are converted to actual markup.

Parameters

$content
(string) The highlighted content.

$start_emp_token
(string) A token string that signifies the start of a highlight.

$end_emp_token
(string) A token string that signifies the end of a highlight.

More information

This hook can be used to remove unwanted highlights from the highlighted content (usually excerpts). When this filter sees the content, the highlighting has been added, but it’s still marked up with tokens, instead of the actual markup.

By default the opening token is **{[ and the closing token is ]}**, so the content you’ll see will look something like this:

Lorem ipsum **{[dolor]}** sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et **{[dolor]}**e magna aliqua.

You can edit the content as you wish, to remove the highlights you don’t want (or to add new highlights!). Just make sure there remains matching closing token for each opening token, otherwise you’ll get broken markup.

After this filter has been applied, the tokens are replaced with the actual markup, depending on the highlight settings.