Integrate Algolia to WordPress site

This is just a normal plugin. You can install it by doing the following: On the Github Page click “Download Zip” button on the right side. On your WordPress admin panel navigation to Plugins Click “Add New” button at the top of the page which will take you to the “Add Plugins” page. Click “Upload … Read more

Search buddypress groups with querystring in url

Not in the url, but you can pass other parameters in the groups loop. There is a search_terms parameter in bp_has_groups(). It also has an orderby parameter that accepts total_member_count as the property. Assuming the tag info is stored in group_meta, you can add a meta_query parameter to the bp_has_groups(). More info from the BuddyPress … Read more

Sort search results by Custom Field

I have managed to apply the proper sorting to the archive-data-base.php file Reading your question, I really do feel that you did not do your sorting correctly in archive-data-base.php as the same logic will be used for the search page as well. I do believe that you have used a custom query to correct the … Read more

Search for two strings in WP search

I am not 100% sure what you are trying to accomplish, but you can “search for both strings” simply by concatenating them: function checkForAa($query){ if($query->is_search){ $search_string = $query->get( ‘s’ ); if( stripos( $search_string , ‘aa’ ) !== false){ $new_string = str_ireplace( ‘aa’ , ‘xxx’ , $search_string ); }elseif( stripos( $search_string , ‘å’ ) !== false){ … Read more

wp_query search not taking keywords with together for multiple words

WordPress also provide more filter to can change wp query using filters. What i need logical to use filter to override query below sample of code if this helpful for you. add_filter( ‘posts_where’, ‘posts_where_condition_search’ ); $wp_query = new WP_Query( array( ‘post_type’ => ‘press-release’, ‘posts_per_page’ => -1, ) ); remove_filter( ‘posts_where’, ‘posts_where_condition_search’ ); function posts_where_condition_search( $where … Read more

How do I amend wp_query before it is run/executed?

Use pre_get_posts to modify the query object before the query has run. – https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-1,-1347’ ); } else if ($query->is_search) { $query->set( ‘s’, ‘stackoverflow’ ); } } add_action( ‘pre_get_posts’, ‘exclude_category’ );

Custom Query Content Filtering

I assume that your posts are having make and model as a Custom Fields and you want to retrieve all those posts which are matching both the passed value for make and model Custom Fields. If that is the case then your code seems to be correct. It might be possible that there is no … Read more

Search form does not work in my website

You’re missing the name of the search text input, so replace: name=”” with name=”s” Then take a look at searchform.php in the default themes, like Twenty Sixteen: <form role=”search” method=”get” class=”search-form” action=”<?php echo esc_url( home_url( “https://wordpress.stackexchange.com/” ) ); ?>”> <label> <span class=”screen-reader-text”><?php echo _x( ‘Search for:’, ‘label’, ‘twentysixteen’ ); ?></span> <input type=”search” class=”search-field” placeholder=”<?php echo … Read more

Replacing search results with custom external query

You can’t return a query object from a pre_get_posts action. In fact, it shouldn’t return anything, the query object is passed by reference. Your second attempt is close, you can unset the s query var so WordPress doesn’t try to search on that term. Of course, now s has no value, so any functions that … Read more