Created
July 16, 2013 03:50
-
-
Save gasatrya/6005613 to your computer and use it in GitHub Desktop.
Make Custom Post Type searchable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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