Just extend your search form with a hidden input: (notice the last input field)
<form role="search" method="get" class="search-form" action="<?php echo home_url( "https://wordpress.stackexchange.com/" ); ?>">
<label>
<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ) ?></span>
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ) ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" />
</label>
<input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>" />
<input type="hidden" value="product" name="post_type" id="post_type" />
</form>
Related Posts:
- Disable Redirect to Product Page on Search Results Page in WooCommerce [closed]
- Improved WordPress search functionality and search form plugin
- Different search results with WordPress and Relevanssi
- Search Results No Link
- Modifying post content with the_post action hook
- Trying to remove plural ‘s’ from search Query but it’s just removing every letter of the end – what am I doing wrong? Thanks
- why pre_get_posts works fine in post type archive, but not in search result list?
- How to get started?
- Search Results Page outputs HTML code
- Custom Query Content Filtering
- Search for two strings in WP search
- Sort search results by Custom Field
- Search buddypress groups with querystring in url
- Integrate Algolia to WordPress site
- Limit search to a specific folder in website
- Make search result display 1 Company or 2 Companies
- Blog search just returns to front page (not search results!)
- Search.php display results differently based on post type
- How do i append UNION SQL Query with default search query
- How to add one more query string with search query string
- Displaying number of search results for each post type
- Search – Only search for post meta field
- How to multiply a post to test internal search results?
- Why is this search form not submitting when button is clicked?
- Search Form Based On Tutorial Not Working
- Order search results by category
- Search not working. Appending a “
- Search posts by Tag
- how to show Author information in search results
- Strip HTML Tags From Search Results
- Search within table?
- How to build an advanced search form by post type?
- Use wordpress search to display results within a post
- How to insert meta keyword to search result page
- Search returns everything if search term has a space
- How to query two meta fields and display results between them
- Search by meta_query
- Change Twentyeleven Search Form Text
- Restrict Search Results to Post Author
- redirected to the login screen when I do a blank search
- BuddyPress – Search members by name and also by username
- Intelligent Search Filtering
- Add Google custom search to wordpress.com [closed]
- Include results with tags relevant to the search keyword with JSON rest API v2
- How to set “split_on_numerics” to false in ElasticSearch mapping using ElasticPress? (for proper SKU search in WooCommerce) [closed]
- Search function does not work on mobile devices
- Should I create a parent page with no content? [closed]
- Custom search Dashboard widget
- Changing default wp search string
- Changing the ORDER BY in WordPress default search function
- some one help . search not jump to search page
- How do I exclude a specific page (and child pages) from the search results?
- Woocommerce Backend Search by Title and SKU
- Why should we use the name attribute with the value “s” in the creation of the search form?
- Sort WP Search results by date
- How to search titles/artist/album within a playlist, and only lists the results that match?
- Disable character’s replace in search
- Sitelinks Search box schema confusion
- Search and Filter Plugin – How to disable redirection
- how to search everything
- The Search FoRM Dilemma || The Search form Templating
- changing search result from only excerpt to full content
- WordPress Search Form Issue | Misleading search URL. | Pointing to wrong URL
- WordPress Multi-Step Product Search
- How to pass data to wordpress page (without GET parameter)
- Cannot pass ‘S’ parameter more than two letters
- Why WP_Query’s ‘s’=>’keyword’ searches only for ‘post_title’ and why not ‘post_content’?
- Check If search query contains something?
- Search for anything in site
- Localization of WP theme
- Show search count by post type
- Echoing home_url() returns current url in searchform.php
- Exclude posts with certain meta data from search results
- Search by Attachment ID
- Custom search search does not work?
- Display Search Results after search 1st link
- Custom search page wont allow URL params
- Make archive page show up in search results?
- How to have multiple instances of the same taxonomy in a search form
- How can I add search box in single.php?
- How Can I Make Dynamic Search Form While Converting Html To WordPress?
- How to detect if the referer is 404 page?
- adding more text to a query string
- Creating a search form and displaying results
- Remove Page Timestamp via functions.php so it doesn’t show in Google Search Result Description [closed]
- Independent search tool that returns exact match of a post title
- Use pre_get_posts to display search results by meta in specific order
- WP + Google analytics = /search?
- Prevent search query from taking place when using Google CSE?
- Search result count not matching actual result
- Get the search element only on 404
- Included posts on a page searchable
- Site Title in my Search URL
- Connecting Google Site Search with WordPress Taxonomies/Categories/Tags
- Search using WP_Query
- I want empty search returns to home page in my wordpress
- When clicking on submit from my searchform it takes me to home.php
- WordPress custom search by post type
- WP_User_Query not searching
- How to remove notice inside search.php when no results are found?