Field Render

Display a Phone Number field which use the Intl Tel Input library.

Field Group

Field Settings

Setting nameDescription
Allow CountriesFilter which countries can be chosen
Preferred CountriesDefine the countries to appear at the top of the list
Default CountrySet the initial country selection
GeolocationLookup the user’s country based on their IP address
Native NamesShow native country names
National ModeAllow users to enter national numbers
Allow DropdownWhether or not to allow the dropdown
Separate Dial CodeDisplay the country dial code next to the selected flag
Default ValueMust be international number with prefix. ie: +1201-555-0123
PlaceholderYou may use {placeholder} to print the country phone number placeholder
Return ValueReturn the phone number array or the phone number

Field Value

Value can then be retrieved using the common get_field() function. Usage example:

$slug = get_field('phone_number');

// +1201-555-0123

Field Validation

By default the field is bundled with a Javascript validation method which use the builtin libphonenumber library included in Intl Tel Input.

While this method work in 95% of the case, some users may bypass that validation by disabling their browser Javascript. In order to validate the field from the server, and make sure the phone is always validated, we recommend to include the libphonenumber for PHP library.

We decided to not include that library by default, as it weighs more than 10MB and we want to keep ACF Extended as much lightweight as possible. You can easily include that library using the ACF Extended libphonenumber for PHP addon. Once activated, the field will automatically use the server validation from the library.