I have a site with a subsection containing a custom post type, "artwork"
I have an overall site search working how I'd like it to - it searches all of my posts and custom post types. I would like to add a second search inside of my artwork subsection, that only searches the "artwork" custom post type. I know I can limit my search results like this:
function mySearchFilter($query) {
if ($query->is_search) {
$query->set('post_type','artwork');
};
return $query;
};
add_filter('pre_get_posts','mySearchFilter');
But that affects the sitewide search too. How can I set the post type ONLY on certain instances of the search form? I don't need a dropdown or any way for the user to choose, there are just certain pages where I'd like to include limited search instead of the overall site search.