Created
December 22, 2018 12:53
-
-
Save spivurno/977d6d9b033d7dcf6b1a80533642ca3e to your computer and use it in GitHub Desktop.
Gravity Perks // GF Populate Anything // Only Show Unique Choices
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 | |
/** | |
* 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