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: 2.5.4

searchwp_indexed_post_types

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:

<?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

Parameters

Parameter Type Description
$post_types Array

Array of post type names to be indexed

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