@KA.MVP You can create hidden fields for ‘orderby’ and ‘order’ with default values ‘post_date’ and ‘desc’ or ‘asc’ in it, you can also put this form inside add_shortcode function explained below and use wherever you want to use by adding shortcode [custom_search_form]
function search_form_func()
{
?>
<form method="get" action="https://www.example.com/" id="sv2">
<input name="s" id="s" size="30" title="Search example.com" type="search" placeholder="Search example.com">
<input type="hidden" name="orderby" value="post_date">
<input type="hidden" name="order" value="desc">
<input type="submit" name="submit" value="Search">
</form>
<?php
}
add_shortcode('custom_search_form','search_form_func');
Related Posts:
- Consistent and Admissible Heuristics
- How do you make Vim unhighlight what you searched for?
- How to search for (partial match) display names of WordPress users?
- How can i move search results onto a specific page?
- Unified search across separate WordPress installations
- How to insert a span inside a search form?
- Extending search query with additional $sentence value
- Search only blog posts (default WP search widget)
- Exclude pages from WordPress search result page
- Disable Redirect to Product Page on Search Results Page in WooCommerce [closed]
- WP User Query with search columns and meta query
- Combining Meta_Query key values for one array
- Search: Only One Result Returned
- How to redirect search result page to post
- Custom Permalinks Break Search Pagination
- Include Author profile in search results
- Adding arg to search results page
- search only pages if on page
- Search form with Category and Sub Category
- I’m trying to expand the scope of the default WP search algorithm. What am I doing wrong?
- How to return HTTP 404 when no search results found?
- Change query variable for wordpress search
- Search Results: Differentiate posts and pages
- How does WordPress know if a URL doesn’t exist?
- Highlight Search Results in Function.php
- More than one search results page template
- How to make a search form?
- Quick and Easy way to Add Search to the P2 Theme?
- Using ElasticSearch on WordPress
- How to restrict wordpress search to pages and disable products listing search?
- WordPress does not find author pages in search
- Display post matching the exact search term
- Show only “Pages” – not posts – on search page
- Search Everything & WP 3.7 update issues [closed]
- Creating a Search Array From Multiple Tables
- Installing Solr for dedicated search
- custom wp_dropdown_categories items in wordpress
- How do I make search only search in post content?
- How can i preserve wordpress database encoding after using wp-cli search-replace with –export flag?
- How to sort by columns within a search result without displaying all rows again after sorting
- How to add re-captcha to wordpress search?
- Where should I start looking if I want to implement my own custom search?
- Limit search to custom field
- How can I get a traceback on function calls?
- Knowledge base high performance Live Search
- Search buddypress groups with querystring in url
- Limit search to a specific folder in website
- Make search result display 1 Company or 2 Companies
- How do i append UNION SQL Query with default search query
- How to add one more query string with search query string
- Why is this search form not submitting when button is clicked?
- Search within table?
- Search by meta_query
- Restrict Search Results to Post Author
- Intelligent Search Filtering
- How Can I Make Dynamic Search Form While Converting Html To WordPress?
- Get the search element only on 404
- Specific website content
- Second page (and next) of search results redirects me to the home page
- search results to a variable in search.php
- Checkboxed term search
- Load search results into a div
- Search in posts’ attachments: title, caption, description
- How to track searches using the REST API?
- Exclude certain Gutenberg blocks from search results
- How to order search results so a specific page appears first when user searches for a particular word?
- make link to search page
- Search results thumbnails different size
- WordPress REST API Search decoded URL with cyrillyc symbols
- Modify wordpress search to search only pages and load matched page not search results
- WordPress User Search Based on Latitude and Longitude
- Remove gray header on Search Result page on WordPress
- How do i get The dropdown to have the value of the sub cat and custom fields
- Why are archived pages showing up in searches and able to be accessed?
- Enable query based wordpress search ?s=
- Partial searches for wp_usermeta
- Search terms in other language turns out to question mark and symbols
- Adding thumbnail to search results & changing content.php
- Search Engine Visibility Issue in WordPress
- Create a custom and powerful search form
- How to search for categories instead of products in Woocommerce?
- Search results show only content by admin post authors
- Buddypress Activity search with OR query instead of AND
- How to exclude one post format from search result?
- Help with WordPress search
- Custom Search Form WP_Meta_Query – Filtering Custom Fields
- Search not displaying results
- Relevanssi show only 1 result
- I need a custom search page to lead to search.php but it goes to index.php
- How To Change Url Doing Some Changes in Search Form
- Adding search box for admin on custom admin page
- Different search results with WordPress and Relevanssi
- How do I create a search form that searches only within a custom post type?
- Two Querys in one Search – Category-Tag nightmare – HOW?
- How to make wordpress Dynamic Search-icon from Predesigned Static Html Search-icon?
- Code in the excerpt of the search page
- WordPress REST API response – not returning results from custom taxonomy, only from title
- Members location sortable based on UK Postcode
- I had removed my phone number from my website footer, but months later it still appears once I look it up on google, how to remove it?
- search posts by POST ID