Home / Admin / Setting the Default Address Scheme to International
Duplicate Snippet

Embed Snippet on Your Site

Setting the Default Address Scheme to International

This snippet is used to update the default behavior of the Address field in WPForms. This will set the scheme to International for all new forms you create after adding the snippet to your site.

<10
Code Preview
php
<?php
/*
 * Change the scheme for the address field 
 *
 * @link https://wpforms.com/developers/how-to-set-the-address-default-scheme-to-international
 */
 
function wpf_dev_field_new_default( $field ) {
 
    // default scheme set to international
    if ($field[ 'type' ] === 'address') {
 
        $field[ 'format' ] = 'international';
 
        $field[ 'scheme_selected' ] = 'international';
 
        $field[ 'scheme' ] = 'international';
 
        $field[ 'country_hide' ] = 'wpforms-hide';
 
    }
 
        // Return
        return $field;
 
}
 
add_filter( 'wpforms_field_new_default', 'wpf_dev_field_new_default', 10, 1 );

Comments

Add a Comment