How to Modify Gravity Forms Country by Hook

This example demonstrates how to limit the country drop down to only a few select countries.

add_filter( 'gform_countries', 'remove_country' );
function remove_country( $countries ){
    return array('Brazil', 'United States', 'Netherlands', 'United Kingdom' );
}

This example demonstrates how to add new countries to the list.

add_filter( 'gform_countries', function ( $countries ) {
    $countries[] = 'Country 1';
    $countries[] = 'Country 2';
 
    sort( $countries );
 
    return $countries;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *