0
votes
1answer
12 views

Custom Search Query – include only custom fields and title

I have a custom post type and I also need a custom search. I want the post title and two custom fields to be indexed/queried. I found solutions for title only and for custom fields but not for both so ...
2
votes
1answer
39 views

Including only current user's posts in search

I am a new WP plugin developer. I want the search page to include only the current user's posts. I first added a new capability read_others_posts to only administrators and editors. Then I tried the ...
0
votes
1answer
22 views

$wp_query when new WP_Query

I'm trying something but I have an issue with WP_Query. I've an Hook on the_post in order to add some variation on the query. add_filter('the_posts', 'query_variation'); function ...
0
votes
0answers
25 views

Search custom post type with multiple queries

I am looking for way to search custom post type with multiple queries. I need to run single query from user search and if that isnt resulting with single post result to use another query. If first ...
0
votes
1answer
36 views

Need help setting up a search form for wordpress [duplicate]

I want to set up a search function as a widget in wordpress. This is the situation that I have. 1- I have 3 custom post types 1.a: Each post type has custom fields and taxonomies. I have regular ...
0
votes
2answers
36 views

Modify Search Query if original Query gave no results

I'm looking for a way to modify the search query if the performed query returned no results. Let's say I'm looking for "Opening times", so I go to this URL: http://mysite.com?s=Opening+times Now, ...
0
votes
1answer
39 views

Search Query that Includes Custom Table

I have a WordPress website that grabs product data from a custom table. I would like to be able to also search from fields in the custom table. Could someone provide a sample query of what this would ...
0
votes
2answers
50 views

have_posts() execution failure

I wanted to create a loop which displays search results in search.php file. I followed all of the instructions in the WordPress Codex tutorial located in here: https://codex.wordpress.org/The_Loop ...
0
votes
0answers
19 views

Search by the title in WP_Query? [duplicate]

From the wordpress offical document website , there are a search parameter which is &s={keywords} However, I wonder is this search is based on everything of the Post? that means if I provide ...
0
votes
1answer
107 views

Custom Search Not Consistent with Results

I've set up a custom search to use the s GET variable on a URL. I want it to fetch certain results but I've come across an odd problem. First, here's my code: $search_term = $_GET['s']; ...
6
votes
3answers
139 views

Can I force WP_Query to return no results?

I'm working on a website with a search feature that allows users to search through a lot of post meta. There is a specific search pattern that I would like to forcibly return no results for. The ...
1
vote
1answer
267 views

Search - Ajax - Alter Query Parameters with Pagination

Too Long ; Didn't Read How do I get pagination to work when I'm creating my query with ajax? I'm working on creating a functional search page that allows the user to filter how many posts per ...
0
votes
0answers
29 views

Custom search result

I've tried to google it for several time but i couldnt find anything clear. I added a select field in the searchform.php, but if the user choose one of the options, i dont know how to show it on the ...
0
votes
0answers
25 views

Search (Custom Form, Custom Search Result)

If I have a form: <form class="search" action="<?php echo site_url(); ?>/page-search?category=2" method="get"> <input type="text" required name="search" placeholder="Search"> ...
0
votes
1answer
51 views

Wildcard search in WP Query

I am trying to do something like this: $args = array( 'post_type' => 'product', 'meta_query' => array( array( 'key' => 'custom-text-field', 'value' => '%rocket%', ...
0
votes
1answer
109 views

Custom post type blog pagination conflict

I have a custom post type called 'emp_case-studies' and it has a page archive. Here is the code for archive-emp_case-studies.php: <?php $blog = $wp_query; $wp_query= null; $args= null; ...
3
votes
1answer
393 views

How to make a WP_Query search with custom post types?

I've registered a custom post type called "node". When I create a basic WP_Query to get posts of that type, it works just fine. Example: $args = array( 'post_status' => 'publish', 'post_type' ...
0
votes
0answers
24 views

WP_Query For Custom Author and Single CPT Search?

I have created a search page where users can search the site with these options: (1) Keyword (2) Keyword in/from 12 different Custom Post Types (CPT's) (3) Keyword in/by a single Author's posts ...
0
votes
0answers
89 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
36 views

Ignore image urls in wp_query search

I'm doing a keyword search using wp_query as so: $wp_query = new WP_Query( 's=' . $_GET['s'] ); It is returning a post that has $_GET['s'] in one of its image URLs, and I don't want this to happen. ...
0
votes
1answer
103 views

Adding Custom Fields to Search

I'm trying to add custom fields to my search so that it can be refined by meta values. Currently I have added some select lists to my normal search: <form role="search" action="<?php echo ...
0
votes
2answers
142 views

Get a list of posts by specific category

I'm trying to build a search query in PHP in WordPress and I need to get all posts by a specific author in a specific category including drafts. For example, is it possible to do something like, ...
0
votes
1answer
355 views

Get custom wp_query search results to appear on search.php

I have a search.php page in my template which works fine when used with the native search widget, but I am making a search plugin which has a custom wp_query in it and I want those results to appear ...
0
votes
1answer
51 views

Custom filter for main search: how to exclude specific post_type from search results

Is there a way to use WP_Query's method, set(), in order to exclude a specific post_type from a global search. Here was my unsuccessful attempt: function _search_all($query) { ...
0
votes
0answers
54 views

How to create a custom search in wordpess matching with title and metadata

I want a custom search in wordpress where the search query should return results matching to post title or with a custom metadata. For example if a user is searching for "chicken" in my site, it ...
0
votes
3answers
393 views

Pagination broken when merging search results with additional WP_Query

On the search results page (search.php) I would like to perform an additional WP_Query to keep a specific order of search result types e.g. search results from authors should always be shown before ...
0
votes
1answer
83 views

Manipulating a query

I'm trying to use my own search form rather than default single-field form. So I made my fields and set the values to the query by using pre_get_posts hook. All things are well. Because of searching ...
0
votes
0answers
37 views

Change output of the function

Below is the Current Function function ajax_result($arg, $id,$pagenumber){ $apiclass = new ajaxwpqsfclass(); // The Query $query = new WP_Query( $arg ); $html =''; // The Loop ...
1
vote
1answer
174 views

Search Custom Post Type with all meta attached?

I'm currently have a search box that's supposed to search a certain post type. It's supposed to check the query against all standard cpt content, tags and the associated meta data. I'm wondering how I ...
0
votes
0answers
28 views

Search by child posts parameters, results as parent post

Let me give you a quick abstract explanation of what I need: 'Cars' is custom post type. Each car has a user associated with it (by custom field). Each user might have more than one car. Visitors are ...
0
votes
1answer
144 views

Why does Wordpress search returns same number of results for every search query?

I am hitting a brick wall, I am searching something on a site I am building and on every search it returns 10 results when I know in the index in relevanssi it shows more for the term I am searching ...
0
votes
1answer
1k views

Custom category search box for WordPress

I've seen plugins that add an additional drop down list of categories to the standard WordPress search bar, however this doesn't really help me at all. My site has a lot of posts in a lot of ...
0
votes
2answers
2k views

Pagination wont work with search results template [duplicate]

I can't seem to get pagination to work correctly in my search results template. The page links appear, but when i click onto page 2, it gives me a 404 error. Search.php <?php global $wp_query; ...
1
vote
0answers
497 views

Custom WP_Query for WordPress Search Results with meta_query

I am using a custom query to generate my search results. The code I am using works perfectly without the meta_query variables in my arguments array. I am trying to compare multiple custom fields with ...
0
votes
0answers
82 views

Creating Advanced Search with text & Dropdowns [duplicate]

I am working to develop an advanced search option. Where there will be fields: Text input Field (Post Title) Dropdown (it will be a taxonomy) Dropdown (it will be a taxonomy) Basically I need ...
0
votes
1answer
399 views

How does Show Posts based on a keyword search work in WP_Query

I am wondering how the search go through by defining 's' parameter in WP_Query. For example if I have a post assigned to "East" term in taxonomy "Direction", the post didn't mention any "East" or ...
1
vote
2answers
131 views

Trying to find a way to query post like normal search would do. within search.php page

I have a costume search in a site i am making. When a user search a certain term, i want to display category list with a count of how many posts are found with in that category. I thought of a way ...
0
votes
2answers
313 views

Custom search: Search posts but display parent page in results

I'm using Wordpress 3.5.1 with a modified twentytwelve theme. My main site structure is based on the Smooth Slider plugin (jQuery Cycle). I have Pages that contain only a shortcode (for example, ...
0
votes
1answer
1k views

Custom Search Result Page displaying only 1 result.

I'm trying to build a custom search results page. The problem I'm running into is that when I enter a search term ; say 'gaming', it will only return one result, being the latest result. I have my ...
0
votes
1answer
492 views

Wordpress search exact match

I have a few search filters set up and I found a few posts that shouldn't be in the search results. On looking into it further I found these posts match 'part' of the keyword. For example, searching ...
0
votes
1answer
613 views

Search.php - return number of results but cannot loop through

I have a following search.php page (this is just the code required for problem presentation). Why is my $total_results returning a number of posts found, but when I do a loop though it always print ...
3
votes
1answer
143 views

Search widget breaks when using multiple loops?

I have created wordpress template that uses two loops via WP_Query object. Everything works fine except Search widget. I've been pulling my hairs out for three days now Googling like a madman,but ...
4
votes
1answer
104 views

Tracing the life of a query

I can't find documentation regarding this - but is there a way to see how a query might bounce around from one filter to another? I've got a list of possible wp_filters and their relevance but I ...
0
votes
1answer
160 views

Can I make a search query which includes a space?

I want to search via WP_Query for the test "hello " including the last trailing space. Is this possible and if so, how do I do this?
1
vote
1answer
1k views

Post_count only shows the number of results per page

I have a wp_query $wp_query = new WP_Query($args); but for some reason the $wp_query->post_count only shows the amount of posts on each page. So if I set 'showposts' => '10' and 12 results are ...
0
votes
1answer
101 views

Query posts by custom fields

I am making a theme for a hotel, and I need to be able to provide functionality to search by the following custom fields: Location and Price. I need to be able to query them from the query string ...
0
votes
2answers
128 views

Search Page Returns Nothing

I'm currently working on this website and a test shows that the search page isn't working properly. Every time someone searches for something, it comes up blank. The code for the search page is as ...
0
votes
1answer
383 views

Multiple keyword search

I have a custom search where I want to enter a keyword or phrase into the search box, and then by pressing enter it adds it to a 'search storage' (already coded, see below). Asume I have 3 posts, one ...
0
votes
1answer
736 views

Custom search form with empty parameters

I'm building a custom search form with keywords and drop down lists (categories, date, and country (have a separate plugin for this)). In the searchform.php I have the input field and then ...
1
vote
1answer
520 views

Advanced search form with filters for custom taxonomies

I'm trying to build a complex search form with filters for several custom taxonomies, a search terms input and a select for the number of items displayed / page. The question has been posted before ...