Skip to content

Instantly share code, notes, and snippets.

@gasatrya
Created July 16, 2013 03:50
Show Gist options
  • Save gasatrya/6005613 to your computer and use it in GitHub Desktop.
Save gasatrya/6005613 to your computer and use it in GitHub Desktop.
Make Custom Post Type searchable
<?php
add_filter( 'the_search_query', 'add_custom_post_type_to_search' );
/**
* Make Custom Post Type searchable
*
*/
function add_custom_post_type_to_search( $query ) {
if ( $query->is_search ) { $query->set( 'post_type', array( 'site', 'plugin', 'theme', 'person' )); }
return $query;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment