Skip to content

Instantly share code, notes, and snippets.

@rickalee
Last active Dec 31, 2015
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