Skip to content

Instantly share code, notes, and snippets.

@spivurno
Created December 22, 2018 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/977d6d9b033d7dcf6b1a80533642ca3e to your computer and use it in GitHub Desktop.
Save spivurno/977d6d9b033d7dcf6b1a80533642ca3e to your computer and use it in GitHub Desktop.
Gravity Perks // GF Populate Anything // Only Show Unique Choices
<?php
/**
* Gravity Perks // GF Populate Anything // Only Show Unique Choices
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gppa_input_choices', function( $choices ) {
global $gppa_uniques;
$gppa_uniques = array();
$choices = array_filter( $choices, function( $var ) {
global $gppa_uniques;
if( ! in_array( $var['value'], $gppa_uniques ) ) {
$gppa_uniques[] = $var['value'];
return true;
}
return false;
} );
return $choices;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment