If you have a “natural” artwork archive (typically setting has_archive to true in your register_post_type() arguments), you already have the functionality in place:
http://example.com/artwork/?s=query
…assuming artwork is your archive slug, WordPress will search only artwork for “query”.
Just set the action attribute of the search form to the archive URL, like so:
<form action="<?php echo get_post_type_archive_link( 'artwork' ) ?>">
Related Posts:
- Create multiple Search functions for posts / custom post types and everything
- pre_get_posts and search query for admin
- Search function works improperly
- Force is_search to always TRUE
- How to exclude pages from WP search based on page title
- why pre_get_posts works fine in post type archive, but not in search result list?
- Search for two strings in WP search
- Displaying number of search results for each post type
- Use pre_get_posts to display search results by meta in specific order
- Search custom posts by meta key in admin
- pre_get_posts improperly searching revisions
- WP search in metadata post
- meta field search too restrictive in pre_get_post() for custom search
- search filter for search and tag page doesn’t work
- grep for special characters in Unix
- How do I remove Pages from search?
- Remove meta robots tag from wp_head
- Template issues getting ajax search results
- How do I search events between two set dates inside WP?
- Search Using Post ID
- template_include for search.php makes WordPress think its on the home page
- Include custom table into search results
- How Do I Use WP_Query to Run This Database Query as Search Result?
- Search pre_get_posts filter which can handle multiple post types and categories?
- ElasticPress Indexing multiple sites
- How to search through pdf media files?
- WordPress Single Conditional for Search Page
- Does WP search natively return results sorted by type (post, post type, page, category…)?
- Do not allow to search certain words
- How to add custom taxonomy to search
- get_query_var(‘s’) not working
- Display title for search engine visitors
- How to avoid the specific page while searching in WordPress without plugin?
- How to show a random selection of posts from the search
- Related Tags Concept
- Default WP search excluding specific characters, is it possible?
- Comparing between a negative and positive number
- Custom search for custom post meta with pre_get_posts interferes with WP search
- Search Result from another wordpress website
- Searching by meta values showing inappropriate result
- Search by keywords with boolean operators
- Redirect All Search Links Containing – to + on WordPress
- How to make wordpress Dynamic Search-Bar from Predesigned Static Html Search-Bar?
- Change WordPress search Permalink structure
- How to load WP categories into array for autocomplete?
- Custom SQL query on wp_users with the addition of wp_usermeta
- Media searching ignored
- Generate list of tags from search results
- Use created page as search results page and custom template
- How do I search dynamically created content?
- WordPress Search not picking up text provided by a Plugin
- using pre_get_posts for search results not found
- What does wordpress search, search?
- How to combine two get_users() array?
- Search not working. Appending a “
- Search posts by Tag
- Change Twentyeleven Search Form Text
- redirected to the login screen when I do a blank search
- Add Google custom search to wordpress.com [closed]
- Changing default wp search string
- How do I exclude a specific page (and child pages) from the search results?
- Sort WP Search results by date
- How to pass data to wordpress page (without GET parameter)
- Check If search query contains something?
- Show search count by post type
- How to search for post content and attached file names
- Alter BuddyPress member search to include search on added profile fields [closed]
- Enhancin 404 to contain a search from URL
- Checkboxed term search
- $wp_query->found_posts not returning correct value
- Search using ACF repeater
- search custom table in wp database with searchform
- How to track searches using the REST API?
- content-search.php duplicating the output for a certain post type
- Form for search pages by meta datas
- WordPress REST API Search decoded URL with cyrillyc symbols
- WordPress Search by tags
- Hide Search Form above results
- searchform.php not included by get_search_form when using wp_dropdown_categories
- Modify wordpress search to search only pages and load matched page not search results
- Problem with search results page
- Search result page as a new page
- Search Engine Visibility Issue in WordPress
- Page has no template
- Search only blog posts on blog page
- Allow users to search for other users in WordPress
- How to stop the search results from loading the wrong template?
- search form display no result
- WordPress search not able to find text in url
- Search & Replace trailing strings
- Returning the entire line of a custom search result filter
- Page/Post path in Search Results
- Search options/filters
- How to search for articles containing two words?
- How do I find a shortcode stored in wordpress?
- Return excerpt on Search
- Attached file how can i work the wp_query to search for related names
- Exclude category in search results in functions.php
- How to quickly search posts by title in Admin interface
- Google indexing pages that are not used