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
- Include custom taxonomy term in search
- Creating a search form for custom fields
- Searching multiple custom post types and pages
- 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?
- 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
- 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?
- No results searching custom post type in admin panel
- custom search result page
- How to search CPT’s by meta query from the admin dashboard?
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Customize Search Results for Custom Post Type
- multiple search forms and search results
- error in Advanced Search Form for Custom Post Types in WordPress array_key_exists() expects parameter 2to be array, string given
- 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
- Set Custom Post Type in Widget Settings for use in Widget
- Displaying and searching Custom Posts
- Search by tag name and category
- Advanced search form with filters for custom taxonomies
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- Different results between permalink and query var search
- How to let users choose where to search for posts?
- WordPress Custom Search by post_type
- Include custom taxonomy term in search
- What content types are shown at a search page?
- Search one custom post type ONLY, disable “all posts”
- Select2 AJAX and WP Query Returns ALL and does not filter
- search custom post type by custom fields on front end
- Custom Search | check multiple meta_value for search value
- Searching post types
- Blank search results on custom search
- Multi Parameter search with custom post type category and tag
- Limit search field to just search a custom post type with custom fields
- Display future posts in search
- Redirecting search to specific templates with $_GET[“post_type”]
- Search custom type post
- How to have multiple search result pages in wordpress with taxonomy terms listed
- WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
- Is it possible to get the specific content on the search page?
- Search for custom field input of a custom post type in ajax live search
- Creating a custom WP query for a Custom Post Type
- In the php, how can I have a category of a custom post type display?
- Search Function not searching correct custom_post_type even though post_type is defined in search args
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- Custom Post type doesn’t appear in search results
- search results to show individual ACF fields from inside custom posts
- post_type incorrect for custom post type
- Live search by custom tag
- Custom search for a custom post type in WordPress
- how to create custom taxonomy drop downs for parents and child
- Search in multiple specific post types
- custom search form for custom post
- Custom post url in search.php isn’t the correct rewrited url
- Manually build WP_Query
- WP_Query with custom post type search showing all results every time
- Extensive search filtering and results->PDF in the front-end
- Trying to modify custom search function in plugin to search postmeta table for keyword as well as posts table
- pre_get_posts not firing at all
- Custom post type blog pagination conflict
- Diffrent search templates for different 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
- Searching for a single custom post type, buddypress
- admin search of pages returns custom post types
- How do I do this?: If custom post type exists, echo it, else do not
- Custom Field Search
- 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