# How can I exclude a Wordpress post type from being indexed?

**URL:** <https://community.swiftype.com/t/how-can-i-exclude-a-wordpress-post-type-from-being-indexed/159>\
**Category:** WordPress\
**Created:** [April 8, 2016, 10:37pm UTC](https://community.swiftype.com/t/how-can-i-exclude-a-wordpress-post-type-from-being-indexed/159 "2016-04-08T22:37:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/swiftype/original/1X/fd652d1735c60057fa71c371375511028f9a1832.png) [@system](https://community.swiftype.com/u/system)\
**Post date:** [April 8, 2016, 10:37pm UTC](https://community.swiftype.com/t/how-can-i-exclude-a-wordpress-post-type-from-being-indexed/159/1 "2016-04-08T22:37:56Z")

</div>

> **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](https://wordpress.org/plugins/swiftype-search/).

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.

```php
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 );

```
