Skip to content

Instantly share code, notes, and snippets.

@jhaus
Created November 29, 2010 23:58
Show Gist options
  • Save jhaus/720864 to your computer and use it in GitHub Desktop.
Save jhaus/720864 to your computer and use it in GitHub Desktop.
search wp custom post types too
<?php
// hook into wordpress search function
add_filter( 'the_search_query', 'aggregated_search' );// Define what post types to search
function aggregated_search( $query ) {
if( $query->is_search ) {
$query->set( 'post_type', array( 'post', 'page', 'feed', 'attachment', 'movies', 'quotes' ));//define search types
}
return $query;
}
//via: http://new2wp.com/noob/wordpress-search-custom-post-types/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment