You could use the get_search_query();
function.
More in developer.wordpress
Related Posts:
- Prevent author bio page from showing in search results
- Can I force WP_Query to return no results?
- Post_count only shows the number of results per page
- WP Query where title begins with a specific letter
- Search custom taxonomy term by name
- Order Search Results Page by meta_value If no Value Return Remaining Results
- Getting all user metadata from user
- Tracing the life of a query
- Want to redirect if search query match exact title of any post
- How to add custom query filters in WP_User_Query
- Pagination not working for Custom search form & custom result template
- How to support multiple search terms query within one process?
- Pagination broken when merging search results with additional WP_Query
- Custom search form with empty parameters
- How to search by title or tags exclusively?
- WordPress search exact match
- Pagination wont work with search results template [duplicate]
- How do I search WordPress by different fields without a plugin?
- Multiple keyword search
- Using next/previous_posts_link with customised search
- WordPress custom search form with pre_get_posts not work
- Search – Ajax – Alter Query Parameters with Pagination
- Add custom search results to main WP search [duplicate]
- Multiple search queries on one page
- tax_query shows no results if nothing is selected
- Filter user list that meta_value is empty
- Query wp_usermeta alongside wp_users
- SQL User Query by Multiple Roles using PHP
- Searching through different categories on different pages code is not working
- WP Query search for attachments and their exact title
- WP_Query’s “request” SQL Query
- Including only current user’s posts in search
- is_search was called incorrectly
- How do I search inside specific taxonomies in WordPress
- Modifying the Search Results
- WP User Query get all authors with last name starting with specific letter
- Custom category search box for WordPress
- Refine search results using WP_Query
- How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
- Search Posts with Custom Fields as query
- Complex date range with WP_Query and BETWEEN
- Creating a custom search for a specific post type
- Sort users by “birthday” using WP_User_Query
- Custom Search Result Page displaying only 1 result.
- How to loop for every result found in the_content() when using the search query?
- Assigning a meta_query value based on regexp to wp_query fails
- showing all search result in one template
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- Is there any advantage of using default WordPress Search instead of creating a custom one?
- WP_Query Not Recognizing Taxonomy Parameter in Custom Search
- Search pages that are a child of the current page
- Include tags in WP_Query
- Search for multiple tags?
- Hide Administrators From User List except current user (administrator)
- Custom Search Not Consistent with Results
- wp_query ‘s’, search filter with pagination is not working
- Editing the default wordpress search
- How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 – 343)
- Multiple Search Terms WP_Query
- How to display user order by role
- Import wp users via one click demo option
- Extend product search with meta in WooCommerce
- WP Query Args – Title or Taxonomy Value
- Display filtered results into custom page
- Dynamic User Id
- WordPress pagination not working on template search.php
- Cutom wp_query for geolocation search, pagination not working
- wordpress search word, “hello world” ===> ‘hello+world’ ===> ‘hello’, ‘world’
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- query_vars overriding WP_Query args
- Query with search and subscribers only output
- how can I override The Events Calendar query modifications?
- Search by post id in a specific page then auto-redirect to searched post
- Search for “2nd” also returns “22nd” in wp_query
- How to make search for posts using get method?
- Categorising search results based on Custom Fields
- Add filter post_where and passing post_type argument
- using pre_get_posts for search results not found
- Search posts missing a particular custom field
- How do I get my custom query to work with search results after the first page?
- Modify Search Query if original Query gave no results
- Include post content of linked posts in search
- Replacing search results with custom external query
- Get multiple users with meta value in one query and populate WP_User class
- How do I amend wp_query before it is run/executed?
- wp_query search not taking keywords with together for multiple words
- Wildcard search in WP Query
- Get a list of posts by specific category
- WordPress Custom Search Form Displaying Unexpected Results
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- Search Page Returns Nothing
- Display if author page is author page of current user
- Get user first name from custom endpoint
- Redirect Search to Form When No Product Results Are Found
- How to properly use AND / OR in custom search
- How to avoid bypass of search bar rules?
- Hide products in uncategorized category from search results
- Issues with search after added meta_query
- How do you determine if a result in a search query is a post or a page?
- Slow Query On Search