Case-sensitive Filter for Database Object Type


Filename: gppa-case-sensitive-filter.php

 * Gravity Perks // Populate Anything // Case-sensitive Filter for Database Object Type
add_filter( 'gppa_object_type_database_query', function( $query, $args, $gppa_object_type_database ) {
	// Replace "order_name" with the column name in which you would like to make the search case-sensitive.
	$search  = "`{$args['primary_property_value']}`.`order_name` = ";
	$replace = "`{$args['primary_property_value']}`.`order_name` = BINARY ";
	return str_replace( $search, $replace, $query );
}, 10, 3 );

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.