If you only want to search a particular post type include a hidden field with the name post_type
and the value set as the name of the post type you want to search:
<form role="search" method="get" action="https://wordpress.stackexchange.com/">
<input type="text" name="s" placeholder="Search">
<input type="hidden" name="post_type" value="post_type_name">
<input type="submit" value="Go">
</form>
Just replace post_type_name
with the actual name of your post type.
Now when you search the URL will look like this:
http://example.com/?s=search+term&post_type=post_type_name
And only return results from that post type.
Related Posts:
- How to create a custom search for custom post type?
- Extending the search context in the admin list post screen
- Include custom taxonomy term in search
- Advanced search form with filters for custom taxonomies and custom fields
- Creating a search form for custom fields
- Searching multiple custom post types and pages
- AJAX search on post pages by custom post type
- How can I change the admin search posts fields?
- How to make a WP_Query search with custom post types?
- group search results by post type?
- Development of a WordPress Search Plugin – Best Practices
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Simple way to search custom-post types only
- Pushing a custom post type to the top of the search results
- Search multiple custom fields by using meta_query
- How do I Paginate Search Results for Custom Post Types?
- Custom post type admin search
- WordPress post sorting with AJAX
- Why have my custom post type searches stopped working after changing URLs / updating WordPress?
- Using standard search function with custom post type
- Search that will look in custom field, post title and post content
- Have different search results template depending of custom post type searched
- Returning search results by relevance, including Custom Post Types
- How to replicate some of Drupal Views functionality in WordPress?
- The right way to create a custom search page for complex custom post types
- Seperating Custom Post Search Results
- Exclude from search all custom posts which are NOT in a taxonomy term
- Exclude a term of a taxonomy with a custom post type in a search
- Search everything (posts, pages, tags, cpt, meta)
- Search Custom Post Type with all meta attached?
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- filter search result with custom post type meta key
- Custom search for custom post type, custom meta and search fields
- Include images from pages in wp search.php results in default wp search
- Separating Search Results By Post Type
- How Do I Use WP_Query to Run This Database Query as Search Result?
- Custom Post Types: pretty search URLs and has_archive
- WordPress Admin Panel search posts with custom post meta values along with title
- Backend search; include CPT meta?
- Custom Search form not working in localhost
- Custom Search | Wrong output & question
- Limit search form to 4 custom post types only
- Group search results by post type, but hide post types with no results
- Search results ordered by custom post types are not grouped
- Is there An Input Checkbox Option That Works like `wp_dropdown_categories()` To Use In A WP Search Form?
- Search Post Title Only [duplicate]
- How can I include meta box content when searching?
- Customize Search to only search current custom post type
- How to search from specific post type with tags?
- No results searching custom post type in admin panel
- Include different loop templates in search query
- custom search result page
- Search tags in CPTs
- How to search CPT’s by meta query from the admin dashboard?
- Set meta_query only for specific post type
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Customize Search Results for Custom Post Type
- error in Advanced Search Form for Custom Post Types in WordPress array_key_exists() expects parameter 2to be array, string given
- Search Custom Post Type Custom Fields
- Custom Post Type not appearing in website search
- Custom Fields vs Separate Table
- Add custom post type archives to search results?
- CPT Meta Searching
- CPT Search Form with Taxonomy filter & Or
- Keyword search limited to specific post type filtered by multiple custom taxonomies?
- How to filter search results by post type?
- How to create an advanced filter search?
- Custom search for custom post meta with pre_get_posts interferes with WP search
- How to search map address in custom post type?
- Custom search results page query, link permalink to post title while separating by post types
- Multiple search template with separate stylesheets
- Advanced search form with filters for custom taxonomies and custom fields
- Problem with custom post type search
- Archive custom template from search
- Searching for a single custom post type, buddypress
- admin search of pages returns custom post types
- Customising wordpress search and using $_GET[“s”]
- How do I do this?: If custom post type exists, echo it, else do not
- WordPress search results
- search this custom post type
- Why does ‘exclude_from_search’ exclude a custom post type from WP_Query?
- Drop Down Filter with CPT as Options for Search Form
- Searching Custom Posts content with JQuery
- Custom Field Search
- WordPress search results grouped by post type
- Custom post archive with search, is_search() is false?
- Why custom search engine only searches in post titles of custom posts?
- How do I provide a search form for a specific post type, that is capable of searching within custom fields of the specified CPT?
- Group search results by post type, but having a unique heading for each section?
- Meta_query question
- How to exclude html tags and class on search
- Multiple search forms and respective results page templates?
- Fix Custom Post Type not appearing in search results?
- Search and filter terms of a custom post type only and display results
- Get a custom post type’s taxonomy type term names displayed as checkboxes and filter
- How to Display Content from Search URLs on Permanent URLs in WordPress?
- Exclude multiple custom post types from search
- Search for portfolio tags & mixing portfoliotags and post tags
- How can I retain get_post_type() in between consecutive searches after a search returns no results?
- How do I create a custom search function to only show contact information if they search for an exact unique identifier?