Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Exclude numbers from index › Reply To: Exclude numbers from index
August 22, 2025 at 2:30 pm
#55299
Keymaster
Hi Sebastian,
Special characters are automatically trimmed during indexing.
Excluding numerical strings from the index is only possible via a custom code:
add_filter( 'asp_indexing_keywords', function( array $keywords ) {
foreach ( $keywords as $keyword => $data ) {
if ( is_numeric($keyword) ) {
unset($keywords[$keyword]);
}
}
return $keywords;
});
Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
After adding the custom code a new index needs to be generated so the numerical values are excluded.