if ( !is_admin() ) {

add_filter('pre_get_posts','searchfilter');

function searchfilter($query) {

if ($query->is_search && !is_admin() ) {

$query->set('post_type',array('product'));

}

return $query;

}

}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.