Created
September 9, 2023 11:21
-
-
Save aimahdi/de08f6abc3709baefe4307e2b724c0b7 to your computer and use it in GitHub Desktop.
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
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