This Documentation is for SearchWP Version 3

Available since: 2.5.4


View Parameters »

Note: You should review this filter before installing SearchWP

By default SearchWP will index all post types that have not been explicitly excluded from searching. Post types that are not enabled on the settings screen will be indexed by default. This is to facilitate on-the-fly configuration changes without having to wait for the index to be rebuilt after enabling or disabling a post type. A byproduct of this decision is that the index may have content from post types you never intend to be searchable. If you would like to minify your index as much as possible you can use this hook to customize which post types are indexed by SearchWP.

Example: To have SearchWP index only Posts and ignore every other post type, add the following to your theme’s functions.php:

// reduce the size of the SearchWP index by only indexing Posts
// and ignoring all other post types completely
function my_searchwp_indexed_post_types( $post_types ) {
return array( 'post' );
add_filter( 'searchwp_indexed_post_types', 'my_searchwp_indexed_post_types' );
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$post_types Array

Array of post type names to be indexed

[wpforms id="3080"]