Phone Number
An international phone number input powered by intl-tel-input. Displays a country flag and dial code selector alongside the number field. Stores the number in E.164 international format.
Settings
The free version has no configurable settings — the field automatically handles dial code display and E.164 normalisation.
The Pro version adds: Default Country, Country Restrictions (allowlist/denylist), Return Format options (E.164, national, with country code object), and strict E.164 validation.
Return values
Returns the phone number string in E.164 international format.
$phone = get_field('contact_phone');
// "+12125551234" (US number)
// "+447911123456" (UK number)
// "+8801712345678" (BD number)
Returns an empty string if the field is empty.
Usage
Displaying as a clickable link
$phone = get_field('contact_phone');
if ($phone) {
echo '<a href="tel:' . esc_attr($phone) . '">' . esc_html($phone) . '</a>';
}
Formatting for display
E.164 format includes the + prefix and no spaces. For a friendlier display, format the string:
$phone = get_field('contact_phone');
if ($phone) {
// Use libphonenumber-for-php for proper formatting
// composer require giggsey/libphonenumber-for-php
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
$parsed = $phoneUtil->parse($phone);
$formatted = $phoneUtil->format($parsed, \libphonenumber\PhoneNumberFormat::INTERNATIONAL);
echo '<a href="tel:' . esc_attr($phone) . '">' . esc_html($formatted) . '</a>';
// "+1 212-555-1234"
}
Basic display with href
$phone = get_field('business_phone');
if ($phone) {
echo '<p class="contact-phone">';
echo '<a href="tel:' . esc_attr($phone) . '">' . esc_html(ltrim($phone, '+')) . '</a>';
echo '</p>';
}
WhatsApp link
$phone = get_field('whatsapp_number');
if ($phone) {
// Strip the leading + for the wa.me URL
$number = ltrim($phone, '+');
echo '<a href="https://wa.me/' . esc_attr($number) . '" target="_blank" rel="noopener">WhatsApp us</a>';
}