Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created March 9, 2012 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jo-snips/2007736 to your computer and use it in GitHub Desktop.
Save jo-snips/2007736 to your computer and use it in GitHub Desktop.
Wordpress: Include Post Types in Search
// Define what post types to include in search
function include_in_search( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array( 'post', 'page', 'feed', 'tribe_events' ));
}
return $query;
}
add_filter( 'the_search_query', 'include_in_search' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment