You will need to modify searchform.php file in your theme directory.
To search for current post type posts add following code inside the form !
$post_type = get_post_type();
if($post_type){
echo '<input type="hidden" name="post_type" value="'.$post_type.'" />';
}
Related Posts:
- How to create a custom search for custom post type?
- Extending the search context in the admin list post screen
- Creating a search form for custom fields
- How can I change the admin search posts fields?
- 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
- Custom post type admin search
- Using standard search function with custom post type
- The right way to create a custom search page for complex custom post types
- Search everything (posts, pages, tags, cpt, meta)
- Search Custom Post Type with all meta attached?
- filter search result with custom post type meta key
- Limit search form to 4 custom post types only
- Search results ordered by custom post types are not grouped
- Search Post Title Only [duplicate]
- How can I include meta box content when searching?
- How to search from specific post type with tags?
- custom search result page
- How to search CPT’s by meta query from the admin dashboard?
- Customize Search Results for Custom Post Type
- multiple search forms and search results
- Custom Fields vs Separate Table
- How to create an advanced filter search?
- How to search map address in custom post type?
- Custom Search for Drafts in Custom Post Type
- Multiple meta_values in the pre_get_posts filter?
- How to order separated Custom Post Search results
- Custom post type search using $_SESSION and pre_get_posts
- How to stick custom post at the top in search results
- Can I search only some of the fields of a custom post type?
- Make parts of your wordpress website completely built with data from external APIs?
- Custom post type not showing in search result
- What to and how to proceed with CPT to make DB small and efficient?
- Auto Complete Search
- Remotely search WordPress sites using xml-rpc
- BBPress Search results in WordPress search
- Limit Search to Post Type With Apostrophe return search not found
- Searching Custom Fields
- filter search custom field query
- Include custom taxonomy term in search
- Can NOT search my custom post type?
- Custom post_type search pages
- WordPress search and date filter not working with custom post type
- Custom filter for main search: how to exclude specific post_type from search results
- Add custom attributes to a post
- Display an icon based on post type
- how to get this tax_query working?
- Custom Taxonomy Search result page
- How to group search results by post type and only if post type result is not empty?
- find custom post type post by searching its custom field with my string
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Category Search / Custom Post Type search on my website. Custom Post Types that are “page-like”?
- Hide custom post type from search based on custom taxonomy
- What is the correct term for a tool that filters content based on metadata?
- Pagination on search results page
- Ideas on how to organize a project [closed]
- Best way to create a search for custom post type by custom field values
- Filtering custom posts by custom fields (ACF) [closed]
- Multi Parameter search with custom post type category and tag
- CPT, meta-data, url parameter
- Search CPT Title AND Meta
- Modifying search results based on post_type
- How to Implement Search Functionality?
- How to have multiple search result pages in wordpress with taxonomy terms listed
- Change search query in wordpress custom post type
- Create a post automatically if search result has zero results
- Search only one custom post type
- Query first and last name from custom post type
- Custom Post type doesn’t appear in search results
- Custom Archive – hide posts until a search is made?
- Display result as “prefix+ID” and show in the search result as bookcode
- Include images from pages in wp search.php results in default wp search
- custom search results – order results differently by post type
- Post search not looking at post title since 4.4.2 upgrade
- Custom Post Search
- WP_Query with custom post type search showing all results every time
- Search form to find custom meta box generated data
- 404 error Custom search results page for custom post types with friendly URL
- multiple custom post type category selection search
- Custom Search Template for Custom Post Types
- Custom Search not working
- Search page for custom post type
- Is it good practice to search for custom posts based on custom field values?
- Cannot get query var ‘post_type’ to work
- Multiple search template with separate stylesheets
- Archive custom template from search
- Customising wordpress search and using $_GET[“s”]
- WordPress search results
- search this custom post type
- Drop Down Filter with CPT as Options for Search Form
- Searching Custom Posts content with JQuery
- WordPress search results grouped by post type
- Group search results by post type, but having a unique heading for each section?
- 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
- 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?