Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Include custom post types in the search results.
<?php // MAKE CUSTOM POST TYPES SEARCHABLE
function searchAll( $query ) {
if ( $query->is_search ) { $query->set( 'post_type', array( 'site', 'plugin', 'theme', 'person' )); }
return $query;
}
add_filter( 'the_search_query', 'searchAll' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment