Skip to content

Instantly share code, notes, and snippets.

@aimahdi
Created September 9, 2023 11:21
Show Gist options
  • Save aimahdi/de08f6abc3709baefe4307e2b724c0b7 to your computer and use it in GitHub Desktop.
Save aimahdi/de08f6abc3709baefe4307e2b724c0b7 to your computer and use it in GitHub Desktop.
add_filter('fluentform/editor_countries', function ($country_names) {
foreach ($country_names as $key => $value) {
if (preg_match("/\([^)]+\)/", $value)) {
$replacedValWithSpaceInBetween = preg_replace("/\s+\([^)]+\)/", "", $value);
$country_names[$replacedValWithSpaceInBetween] = $replacedValWithSpaceInBetween;
} else {
$country_names[$value] = $value;
}
unset($country_names[$key]);
}
return $country_names;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment