The Search FoRM Dilemma || The Search form Templating

Checking if showing Search Results The conditional statement you want is is_search() documented here. Search.php and Content-search.php Search.php is the template file that corresponds to displaying results from a search form request. If it is not present in the theme (meaning there is no search.php) then wordpress defaults to index.php and uses that. Changes to … Read more

how to search everything

The main search uses any custom post types (when you don’t set post_type query var) so if you’re missing public custom post types from that, then most likely those custom post types are registered with exclude_from_search as true. Check if the plugins have filters to change that or try e.g. to override it with: add_filter( … Read more

Search and Filter Plugin – How to disable redirection

Welcome to wordpress.stackexchange.com. The plugin is possibly redirecting to a theme search results page that does not exist in your theme. Therefore the search results are not show. For example in the Twenty Seventeen theme the files needed to display the search box and search results are search.php and searchform.php. Both files can be found … Read more

Search Media by taxonomy

To search, use the s option as described in the WP_Query documentation https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter Search Parameter Show posts based on a keyword search. s (string) – Search keyword. Show Posts based on a keyword search Display posts that match the search term “keyword”: $query = new WP_Query( array( ‘s’ => ‘keyword’ ) ); Prepending a term … Read more

How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?

Looking at WP_Tax_Query and WP_Meta_Query used by Wp_Query, they return their respective where clauses with an AND relation, and no hook or $args to change that behavior. Furthermore, the tax_query is computed before the rest of the main query so that it’s included in the main query in term_taxonomy_id IN (…) form. Also the WP_Tax_Query … Read more

change posts_orderby of the callback wp_query?

Ok, found the answer! I added ‘query_id’parameter in my query $query_string = sanitize_text_field( wp_unslash( $_GET[‘searchString’] ) ); $page_no = intval( $_GET[‘pageNo’] ); $posts_per_page = 9; $offset = ( $page_no – 1 ) * $posts_per_page; $search_args = array( ‘posts_per_page’ => $posts_per_page, ‘post_status’ => ‘publish’, ‘perm’ => ‘readable’, ‘s’ => $query_string, ‘offset’ => $offset, ‘query_id’ => ‘my_custom_ajax_search’, … Read more

wp_query show all values

The example below just changes what args is based on your 3 input fields. This eliminates the need to check for these values (and using “all” for value). I’m sure some combination of logical operators for compare and relation would do the job but this works too. if (isset($_GET[‘front-side-prop-search’])){ // test whether $city has a … Read more

Sitelinks Search box schema confusion

Without getting into the structured data itself, it is important to remember that the actual url on which wordpress will run the search has to be the home page. If you are using “pretty permalinks” wordpress will probably try to parse the url as content, not as search for almost anything that is not the … Read more