Search queries don’t seem to work?

I’ve found that passing post_type doesn’t restrict searches to that type, but just adds that type to the array it already searches. What you can do to build complex search queries is hook pre_get_posts and do a little query manipulation. For a simple example, first I add my own query var to pass to WordPress’s … Read more

custom search results affected by _REQUEST set

A colleague of mine gave me this helpful answer, I hope it helps others: “To answer definitively, I would need to see a bit more code. Nonetheless, WordPress does override $_REQUEST, so depending on where this code is placed, it may be overwritten. So assuming that the parameter is being passed in the URL, I … Read more

WordPress Search not picking up text provided by a Plugin

WordPress searches the columns post_title and post_content. If you add your content to these columns they are searched. If you add the extra content per filter or shortcode during output you need a search plugin that is capable of indexing rendered pages (Relevanssi or Search Everything for example).

Using search.php without a ‘s’ field in searchform.php

I am not sure as how to get around using id=”s” in the input field. But just to clarify, I believe wordpress is doing something like $input = $_POST[“s”]; when the search is submitted. The id=”s” is necessary because it tells the php script from which html input field to pull the input from. WordPress … Read more

How can I implement Search feature for Membership site?

There is no easy way to do this without modifying the main search query that was generated by wordpress. I think you should go for posts_search & posts_join hook. They are located in wp-includes/query.php Do a var_dump first to see what you are getting & modify accordingly. Here’s some untested code i could put up … Read more

Template issues getting ajax search results

When you load a template file directly that way, you’re not loading the WordPress environment, so no WordPress functions are available. Your two options are to either load the search page on the front end and filter the result, like: $(‘#results’).load(‘http://mysite.com/?s=searchterm ul#target’); Or build a search function using WordPress provided AJAX functionality, see AJAX in … Read more