You are missing the search parameter in your arguments. The code below, when added to the array in $the_query
, should pass along the query string variable from a search:
's' => $s
Documentation is available here:
https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter
Related Posts:
- How to create a WP_Query to search the Title or Tag?
- How do I dynamically generate args for wp_query?
- Use wp_get_recent_posts with search term
- have_posts() execution failure
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Can’t search posts using WP_QUERY inside AJAX Function
- WordPress pagination not working with search page
- WP Query with custom Shortcode
- Exclude posts with specific metadata from search?
- Form search query – displaying ACF “Post Object” field as results
- Search.php gets metadata from first post
- Search AJAX Filters – Multiple Query Loops Into One Loop (Optimization)
- How can I modify this code to make the search box include tags and meta
- Free search and custom taxonomy query not providing the same result
- search.php to search only the post title
- WordPress Search Ajax + Isotope + InfiniteScroll
- Replace a single variable with add_filter
- Using a new WP_Query inside the loop
- meta_query search names when they have middle initials
- Include search tags and users in my search results system
- How to make a search button that will search my website?
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Using foreach loop breaks
- WordPress Search Results for Multiple Post Types
- Create WP_Query to search for posts by their categories or their parent/child categories
- wp_query with cat not working
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- How to use an associative array in post__in with WP_Query?
- If Query In Sidebar
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- Compare post-IDs within WP_Query? (Less than / Greater than)
- Customising the search function?
- How to add seperate classes to no-search-result and found-search-result pages on wordrpess search – is_search()
- How to use $query->set with post__in?
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Custom search results page not working with empty search
- Loading the same WP_Query in two different wordpress .php templates
- How to prevent WP_Query function from returning all posts when empty?
- Dynamic content based on a URL parameter
- Display a specific category of products in shop page and disable code for specific actions
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- WordPress default Search function inconsistent in WooCommerce Product Titles
- Add more button if more 8 items
- How to store post ID’s in cookie or session to display the same posts later
- Save Search System
- WordPress, AJAX and pre_get_posts using conditional tags
- Seach custom post type posts only by meta fields?
- Get users that likes the post
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Exclude posts based on meta value
- Search not showing all results
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Autocomplete search box
- Custom query, checking values of multiple meta keys
- WordPress Multiple Navigation bars
- auto-populating custom nav with all items from custom post type
- inserting a post from an extern php file but post content doesn’t show on wp site
- edit search.php to include subdomain posts
- Remove echo from shortcode
- Search Query: how to construct a search string from two select elements?
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- Using Select HTML in Bootstrap Popovers
- Can anyone offer any help with this function?
- Add class to group inner container
- WordPress theme options error
- WordPress style.css not updating, only after theme reload
- Security for data obtained from the database
- Fatal error: Call to a member function query() on a non-object
- Get posts from multiple post type
- Is it possible to retrieve all posts with a certain value for metadata?
- How to get all author posts outside of author templates
- WP_Query fails despite having 1 post
- Create a Blog Template Page
- unable to use ‘new WP_Query’ in AJAX call
- Search WordPress using static html page
- wp_query get the 2nd post
- How to get post ID in a Page?
- Display an image if odd number of posts in grid
- Use Tags to initiate Search
- Search form does not work in my website
- How to retrieve the data from the sever and displaying it in a page?
- How to add div blocks after certain set of post
- How to overwrite orderby with add_query_var
- Why doesn’t PhotoSmash plugin play well with wp_query?
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- get_the_ID() in the footer returns wrong value
- Trouble inputting variable into WP query
- the_posts_pagination() not working in wpquery
- How to override url params with rewrite rules vars?
- WP_Query: getting posts where custom field exists
- How to show meta value code HTML after x paragraph
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- Convert a string into a decimal number for use in query
- How to display SQL query that ran in WC_Order_Query?
- get_the_ID() doesnt work
- Array to string conversion on array_map
- Store metakey value as an array
- Increment paged on WP_Query
- Target post_date_gmt if it’s empty or not set
- Hide posts if user is added to it WP_query