0
votes
0answers
28 views

Removing “s” from search with custom parameters

I'm trying to do something that I thought would be quite simple and has turned out to be not simple at all. I've seen quite a few posts that look similar at first glance but none solve the issue for ...
0
votes
1answer
41 views

Using pre_get_posts to rewrite search query to display posts from multiple taxonomies

This seems like it should be straightforward, but I'm stuck on it! If a user searches for 'alice', I would like to show them all posts with the custom taxonomy terms of 'bob' and 'carol', regardless ...
0
votes
1answer
23 views

Displaying number of search results for each post type

Using the code below, my search returns results from two different CPTs. How can I display the number of results for each CPT before displaying results? function more_posts_per_search_page( $query ) ...
0
votes
0answers
63 views

Using WP_Query IN pre_get_posts while searching

This is a continuation on this question. What I'm trying to do, is rerun a search query, to loop through it and index the taxonomy counts (so I can make some kind of facet search). What I do is this ...
0
votes
1answer
58 views

Run search query again without pagination gives no results?

Update: This question isn't really relevant anymore. I switched some code, so now the filtering works. Looks like the query wasn't working, because I triggered the indexTaxonomyCounts function from ...
0
votes
0answers
118 views

Searching custom fields with pre_get_posts

UPDATE: 12.4.13 I'm now using a posts_where filter. It looks like this: function posts_where( $where ) { if ( is_search() ) { global $wpdb; $beds = ( ! empty( $beds ) ) ? ...
1
vote
1answer
93 views

Multiple meta_values in the pre_get_posts filter?

I have a custom post type with custom fields, the one in particular is "zip". I also have an array that stores like 20 different zip codes. I want to check to see if any of those custom post types ...
0
votes
1answer
660 views

filter search result with custom post type meta key

The default search returns all post types, which is what I want. But for one specific custom post type I want to limit the result to a specific meta key value (a custom date that must be greater than ...
1
vote
2answers
418 views

Force is_search to always TRUE

I'm extending the search functionality by adding custom query vars to the search query object via pre_get_posts so that it'll be able to include tax_query and meta_query as search conditions. ...
2
votes
1answer
1k views

Search ONLY by meta key / meta values

I'm almost there on this one. On functions.php i have this: function base_home_product_post_type( $query ) { if($query->is_search() && $_POST['box'] == 'sku') { ...
0
votes
2answers
817 views

How Do I Use WP_Query to Run This Database Query as Search Result?

I have created a search box with a drop down box of 4 options to customize the search: A general default search, no filter A custom search according to the post title for a custom post type only. A ...
2
votes
1answer
837 views

Custom search filter causes menu and query_posts problems

I'm using a custom search filter (using my custom query var type), like so: function fteh_pre_get_posts( $query ){ if( isset( $query->query_vars['type'] ) ) $types = explode( ',', ...
1
vote
1answer
446 views

Custom post type search using $_SESSION and pre_get_posts

I've been hacking all day at a custom post type search/filter system. So far I have this: function kdev_property_query($query) { if(isset($_POST['rooms_n'])) $_SESSION['rooms_n'] = ...
0
votes
2answers
639 views

using pre_get_posts for search results not found

function hotlinkers_wp_query($query) { if ( !$query->is_admin && $query->is_search) { $search_query = str_replace('-',' ', $query->query_vars['s']); ...
2
votes
1answer
1k views

Create multiple Search functions for posts / custom post types and everything

I'm currently working on a search function in a wp site. The plan is to have a search function on the news page which just searches posts. I'm achieving this by adding the below to my functions.php ...