Filter it using pre_get_posts
, like this:
function searchfilter($query) {
if ($query->is_search && !is_admin() ) {
if(isset($_GET['venue_type_search'])) {
$venue_type = $_GET['venue_type_search'];
$query->set('tag',array($venue_type));
}
}
return $query;
}
add_filter('pre_get_posts','searchfilter');
Related Posts:
- Can I force WP_Query to return no results?
- Order Search Results Page by meta_value If no Value Return Remaining Results
- Tracing the life of a query
- Want to redirect if search query match exact title of any post
- How to support multiple search terms query within one process?
- Custom search form with empty parameters
- Pagination wont work with search results template [duplicate]
- Search – Ajax – Alter Query Parameters with Pagination
- Multiple search queries on one page
- tax_query shows no results if nothing is selected
- 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
- Custom category search box for WordPress
- Refine search results using WP_Query
- Search Posts with Custom Fields as query
- Complex date range with WP_Query and BETWEEN
- 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
- Search for multiple tags?
- wp_query ‘s’, search filter with pagination is not working
- Multiple Search Terms WP_Query
- WP Query Args – Title or Taxonomy Value
- Display filtered results into custom page
- 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?
- How to make search for posts using get method?
- Categorising search results based on Custom Fields
- 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
- Prevent author bio page from showing in search results
- How do I amend wp_query before it is run/executed?
- Get a list of posts by specific category
- WordPress Custom Search Form Displaying Unexpected Results
- Redirect Search to Form When No Product Results Are Found
- How to properly use AND / OR in custom search
- Issues with search after added meta_query
- Slow Query On Search
- Sorting search results with custom dropdown
- How To Keep Search Title the same on paged Results
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- How to restrict search on a certain page to only return results against custom taxonomies?
- Filter out a meta key in the Search results page with two CPT
- Query by key or author
- Can I make a search query which includes a space?
- How to filter a static post page with ajax and $wp_query
- Searching not only by post name but also category
- $wp_query->found_posts not returning correct value
- How to search by slug and old slug in single API
- My combination of ‘post_type’ and ‘tax_query’ not working?
- Block internal search queries with pre_get_posts and regex rules
- How to make the WP query search for the “s” arg in other places too
- Search Exact on WordPress – Relevannsi Solution Not Working
- Excluding posts from search results page with meta query not working
- Pagination repeating posts on search results
- I have problems with the search query using multiple post types
- WP_Query no result if keyword contains number
- Categories In English version showing not canonical URL, instead shows query search result
- Filter admin ajax data by url query
- How to extend WP_query to a specific table?
- getting posts by tags
- Add to search posts query array with post IDS which will appear first
- Custom Post Type WP_Query with filters and search
- WordPress search page pagination displaying but not functional
- Search has query that will return no results
- WP Query – Search in title or author_name
- Get posts by similar names and categories
- Logging search queries for logged-in users
- How to show terms from another taxonomy
- Search Field that allows options of “Match any keyword” or “Match all keywords”
- How can I modify standard search query to include also ACF custom fields values?
- A very strange problem with search query
- Search format not matching taxonomy query
- Search Functionality broken by the wp 4.2 update
- Custom search (wp query by custom fields)
- Custom Search Query – include only custom fields and title
- $wp_query when new WP_Query
- Need help setting up a search form for wordpress [duplicate]
- Search Query that Includes Custom Table
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Search query alteration not working for meta values
- Search results stuck on page 1
- Advanced Search – Is this possible?
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string
- AJAX multiple search boxes not merging with array merge