SearchWP

Available since: 2.0

searchwp_exclusive_regex_matches

Note: Use of this hook will require a manual reindex

SearchWP uses what it calls a Regex Whitelist when indexing content. This Regex Whitelist is an array of regular expression patterns that are evaluated prior to indexing content. These matches are excused from further tokenizing and sanitization and indexed as they sit.

By default, SearchWP does not remove the matches from the content pool, which results in both the regular expression matches and the tokenized versions of those matches to both be indexed. If you would instead prefer that only the regex matches themselves are included in the index, add the following to your theme’s functions.php:

<?php
add_filter( 'searchwp_exclusive_regex_matches', '__return_true' );
view raw gistfile1.php hosted with ❤ by GitHub