Skip to content

Instantly share code, notes, and snippets.

@rickalee
Last active December 31, 2015 18:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Search Equipment
function search_filter($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_search) {
$query->set( 'post_type', array( 'listing' ) );
$query->set( 'posts_per_page', -1 );
}
}
}
add_action('pre_get_posts','search_filter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment