Created
June 3, 2019 18:26
-
-
Save slaFFik/fd3eae413f4d8036f1f6b06c2deb8f34 to your computer and use it in GitHub Desktop.
WPForms: change the key of a country from country code to country name
This file contains 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 | |
add_filter( 'wpforms_countries', function ( $countries ) { | |
$key_from = 'CA'; | |
if ( array_key_exists( $key_from, $countries ) ) { | |
$keys = array_keys( $countries ); | |
$keys[ array_search( $key_from, $keys, true ) ] = 'Canada'; | |
return array_combine( $keys, $countries ); | |
} | |
return $countries; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment