Created
October 31, 2024 15:30
-
-
Save saifsultanc/8ce37288e82e243de84653e7b56c65bb to your computer and use it in GitHub Desktop.
gppa-filter-advanced-select-search.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gppa_object_type_query', function ( $query_builder_args, $args ) { | |
global $wpdb; | |
if ( ! wp_doing_ajax() || rgar( $_REQUEST, 'action' ) !== 'gp_advanced_select_get_gppa_results' ) { | |
return $query_builder_args; | |
} | |
$property = $args['templates']['label']; // Choice Template Label | |
$operator = 'LIKE'; | |
$value = rgpost('term'); | |
$query_builder_args['where'][0][] = "`{$query_builder_args['from']}`.`{$property}` {$operator} '%{$value}%'"; | |
return $query_builder_args; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment