Note: You are viewing the documentation for Version 3View Version 4 Docs

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

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’ )

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP