Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WPForms: change the key of a country from country code to country name
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
You can’t perform that action at this time.