Created
November 29, 2010 23:58
-
-
Save jhaus/720864 to your computer and use it in GitHub Desktop.
search wp custom post types too
This file contains hidden or 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 | |
// 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