Ignore Empty Search Value

When filtering Populate Anything results using the “Advanced Select Search Value” option, by default, it will not show any results until the user has entered a search value. This snippet will ignore the search value filter if no search value has been entered, displaying the first 50 results and allowing the user to infinitely scroll through the all results.

Code

Filename: gpadvs-ignore-empty-search-value.php

<?php
/**
 * Gravity Perks // Advanced Select // Ignore Empty Search Value
 * https://gravitywiz.com/documentation/gravity-forms-advanced-select/
 *
 * When filtering Populate Anything results using the "Advanced Select Search Value" option, by default,
 * it will not show any results until the user has entered a search value. This snippet will ignore the
 * search value filter if no search value has been entered, displaying the first 50 results and allowing
 * the user to infinitely scroll through the all results.
 */
add_filter( 'gpadvs_js_init_args', function( $args ) {
	$args['ignoreEmptySearchValue'] = true;
	return $args;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.