How to display "US" as the first choice but leave the default country field blank?

I have an address field set to “International” type and “US” as the default country. Is it possible to have a blank (or a placeholder like “select …”) and then have “US” as the first choice?

This relates to my earlier inquiry, but a solution here may render my earlier inquiry moot.

Hi Yumei,

Avoid setting a default country, as it will be displayed first and may prevent the placeholder from being selected automatically. Therefore, I have set “Select” as the placeholder for the country so that it is initially selected.

I have combined two functions into one based on the documentation below to remove the US from the list initially and then add it back to the top of the list.

Please install the Code Snippets plugin or add the following code to your child theme’s functions.php file.

add_filter( 'gform_countries', 'modify_countries_list' );

function modify_countries_list( $countries ) {
    $key = array_search( 'United States', $countries );

    if ( $key !== false ) {
        unset( $countries[ $key ] );

    // this time we'll add the US at the top of the list
    array_unshift( $countries, 'United States' );

    return $countries;

You’ll see the US stay at the 2nd position after the placeholder text.

Give it a try, and let me know how that goes! :smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.