lisaleague
12/19/2014 - 11:34 PM

From https://swiftype.com/questions/how-can-i-exclude-a-wordpress-post-type-from-being-indexed

// Removes Custom post types from being indexed
function exclude_swiftype_documents( $document, $post ) {
    $excluded_post_types = array('custom-post_type','custom_post_type_2');
    $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 );