Is there a way to prevent specific post types from being indexed by the Swiftype WordPress plug-in?
This can be accomplished with version 1.1.34 or higher of the Swiftype Plug-in.
Add the following code to your WordPress theme’s functions.php
and then update the values within the **$excluded_post_types**
array with your relevant post types.
function exclude_swiftype_documents( $document, $post ) {
$excluded_post_types = array('VALUE1', 'VALUE2');
$post_type = get_post_type( $post );
if ( in_array( $post_type, $excluded_post_types ) ) {
return NULL;
}
return $document;
}
add_filter( 'swiftype_document_builder', 'exclude_swiftype_documents', 10, 2 );