Searching Custom Fields

Updated this answer in response to first comment below: if(!empty($_GET[‘city’]) AND !empty($_GET[‘state’])) { // if both fields are filled out, find houses that match both $relation = “AND”; } elseif(empty($_GET[‘city’]) OR empty($_GET[‘state’])) { // if either of the fields are empty, find houses that match either field $relation = “OR”; } $args = array( ‘post_type’ … Read more

paginate_links() don’t properly work in search.php?

I’m fairly certain this is answered elsewhere, but I’ll add it here again. I believe your issue lies here: ‘current’ => max( 1, get_query_var(‘paged’) ), Try this instead: global $wp_query; $wp_query->query_vars[‘paged’] > 1 ? $current = $wp_query->query_vars[‘paged’] : $current = 1; …then: ‘current’ => $current; Your ‘base’ may also be an issue. Instead of this: … 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).

AJAX search as you type? [duplicate]

I have developed an ajax search plugin a few weeks ago. There is a free version available at the wordpress plugin repository. Feel free to explore the source code 🙂 You can find it here: Ajax Search Lite There is also a commercial version, maybe you are interested: Ajax Search Pro You can check out … Read more

Search by tag name and category

use this function put in function.php file for cat=22 filter change your cat id for you mind function my_search_form( $form ) { $form = ‘<form role=”search” method=”get” id=”searchform” action=”‘ . home_url( “https://wordpress.stackexchange.com/” ) . ‘” > <div><label class=”screen-reader-text” for=”s”>’ . __(‘Search for:’) . ‘</label> <input type=”text” value=”‘ . get_search_query() . ‘” name=”s” id=”s” /> <input … Read more