How to search for an exact match

GravityView's current search functionality doesn't use exact match, so if you search for the word "Kansas", results containing that word, like "Arkansas", will also show up:

If you wish to change the search functionality to look for exact matches, then you need the function below:

add_filter( 'gravityview_search_operator', 'gv_change_search_operator', 10,2 );
function gv_change_search_operator( $operator, $filter = array() ){
	$run_on_view_id = 100; // Change the View to the ID of the View you want to match
	/* That is all you need to edit! */

 	if ( ! function_exists('gravityview') ) { 
		return $operator; // return original operator
	if ( ! $view = gravityview()->request->is_view() ) {
		return $operator; // return original operator
	if ( $view->ID === $run_on_view_id ) {
		return 'is'; // Return exact match operator
	return $operator;

Here's the end result:

If you need to target just a specific field from a specific form, then the code is a little bit more complex. To achieve that, we've created a simple plugin that you can download here. You'll need to modify the Form ID and Field IDs inside that plugin's code using the plugin editor on your WordPress Dashboard:

 Please contact our support if you need further assistance.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.