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 do I use WP_query with multiple post IDs?
- Inject post (from specific category) between posts in Loop
- How to correctly submit a search form and display the result in an independent page
- is_page() not working from within a plugin
- Easy way to process search results before displaying
- Passing JSON data from WP Query into AJAX causing NULL errors
- AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely
- How to add 2 posts under another post? Formatting should be intact
- Count number of published posts by type
- How to display custom field on homepage
- Can an array be used as a meta_query value?
- Can’t increase posts_per_page by variable
- Get taxonomy terms only of the WP_Query current posts
- Get category name from custom loop and echo it once
- Can I use HTTP POSTs? Is there a better alternative?
- Hide post if matches current month and year
- get current custom post ID by WP_Query method
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Create WP_Query to search for posts by their categories or their parent/child categories
- If Query In Sidebar
- Dynamic content based on a URL parameter
- WordPress default Search function inconsistent in WooCommerce Product Titles
- Search not showing all results
- WordPress Multiple Navigation bars
- How to get all author posts outside of author templates
- How to get post ID in a Page?
- Search form does not work in my website
- get_the_ID() in the footer returns wrong value
- How to override url params with rewrite rules vars?
- How to display SQL query that ran in WC_Order_Query?
- Store metakey value as an array
- Post not populating for custom post type based on category selection
- WP_Query multiple post results
- Handling repeater data
- Infinite Loop – WP_Query
- How do I query a single data value from the wp_metadata table?
- Searching Posts Programmatically in a WordPress Plugin
- Search only working on front page (index) , not working on other pages
- Live search from database table
- Toolbar Hidden in a Virtual Page
- WordPress SQL JOIN query
- WP_Query and help with the loop for magazine front page
- Validate search against a list of codes in wordpress
- How to WP_Query posts order by parent title?
- WP_Query – How to query all of post types categories
- How to work Woocommerce pagination inside shortcode?
- Highlighting Text in Search Results
- get different meta-data of a complicated query at the same time
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- wp_Query with mutuplea values returns all posts
- WordPress sorting posts by date and title using a dropdown
- Use WPQuery to match to specific repeater row in post
- WP_QUERY post_in problem
- how to get data from two different table from wordpress database
- Assign meta_query value to php variable
- WordPress search query, how to modify the sql
- Modify post image in full size
- Making list of posts with chosen description
- Ordering / grouping posts by datepicker ACF
- Add custom taxonomy to custom search for posts
- what’s the syntax for if the image exists get the image?
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- How can you disable search for non-members on your WordPress website.
- Custom Thumbnails [closed]
- Retrieving specific images from Media Library
- direct query to post_meta table
- Limit Search Queries per IP per Day
- List sibling pages widget, exclude current page
- Why does WP_Query show only the same post even with different categories and endwhile?
- show/hide attachments
- split searchresults into different topics?
- Does wp_query and query_posts affect website performance? [duplicate]
- WordPress post pagination on custom template not working
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- Show post like this image in my newssite [closed]
- Variable ++ in query loop
- a problem in class in class-wp-hook.php
- Count custom posts type and filter by tag
- Woocommerce – Include custom user meta in order ‘filter by registered customer’ Ajax search
- AJAX WP_Query’s order and orderby parameters not working