SearchWP

This Documentation is for SearchWP Version 3

Available since: 1.6

searchwp_excluded_custom_fields

View Parameters »

By default, SearchWP excludes Custom Fields used by WordPress core to store data that is rarely (if ever) useful during searches. If you would like to modify the array of meta_keys that are excluded when indexing, use this filter.

Example: To modify the meta_keys excluded from the SearchWP index, add the following to your active theme’s functions.php:

<?php
function my_searchwp_excluded_custom_fields( $keys ) {
// by default _wp_page_template is excluded but we want to include that
// so we'll return everything else we want excluded
$keys = array(
'_edit_lock',
'_edit_last',
'_wp_old_slug',
);
return $keys;
}
add_filter( 'searchwp_excluded_custom_fields', 'my_searchwp_excluded_custom_fields' );
view raw gistfile1.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$keys Array

The default keys that are excluded by the indexer ( ‘_edit_lock’, ‘_wp_page_template’, ‘_edit_last’, ‘_wp_old_slug’ )