How to disable WordPress Search from Url?

There’s a filter to remove this feature, which is known more commonly as autocorrecting the URL rather than “search” per se. Place this in your site-specific plugin or your custom/child theme’s functions.php file: remove_filter(‘template_redirect’, ‘redirect_canonical’); There is also an old plugin that does this. See https://www.bloggersignal.com/stop-wordpress-from-guessing-urls/ for details.

Any reason why search result lists only one entry?

What template does search page use? It is either generic index.php or specialized search.php. What does Loop in that template look like? I suspect this might be Loop issue that is set to only dislpay single post, instead of iterating all of them.

Search Results: Differentiate posts and pages

<?php if(get_post_type() == ‘page’): // Only pages ?> <div class=”recent_postMetaSingle”> <img src=”https://wordpress.stackexchange.com/questions/31727/<?php bloginfo(“template_directory’); ?>/images/eye.png” alt=”Views” title=”views” /> <?php print_page_views(get_the_ID(”)); ?> <p>This is a static page!</p></div> <?php elseif(get_post_type() == ‘post’): // If not page, Only posts ?> <div class=”recent_postMetaSingle”> <img src=”https://wordpress.stackexchange.com/questions/31727/<?php bloginfo(“template_directory’); ?>/images/eye.png” alt=”Views” title=”views” /> <?php print_page_views(get_the_ID(”)); ?> &nbsp;&nbsp;&nbsp; <img src=”https://wordpress.stackexchange.com/questions/31727/<?php bloginfo(“template_directory’); ?>/images/comments2.png” alt=”Comments” title=”comments” … Read more

Change query variable for wordpress search

The code you found works not by changing the query variable but by converting another variable into the s variable that WordPress expects. If you look at the WP_Query object, that s parameter is pretty deeply embedded into Core functionality. The simple solution, and perhaps the only one, is to choose some other parameter for … Read more

Advanced Search by minimum/maximum values

A meta_query is an array of arrays. You only have an array. $query->set(‘meta_query’, array( ‘key’ => ‘shru_price’, ‘value’ => $_GET[‘minPrice’], ‘compare’ => ‘>=’, ‘type’ => ‘NUMERIC’ )); It should be: $query->set( ‘meta_query’, array( array( ‘key’ => ‘shru_price’, ‘value’ => $_GET[‘minPrice’], ‘compare’ => ‘>=’, ‘type’ => ‘NUMERIC’ ) ) ); And please validate/sanitize that user supplied … Read more

Comparing between a negative and positive number

I tried the following code: $posts = get_posts([ “post_type” => “CUSTOM_POST_TYPE”, “meta_query” => [ ‘relation’ => ‘AND’, [ ‘key’ => ‘longitude’, ‘value’ => [-0.9895, 1.3125], ‘compare’ => ‘BETWEEN’, “type” => “NUMERIC”, ], ], ]); When I remove “type” => “NUMERIC”, I could reproduced your problem because the comparison is string based. But when adding the … Read more