Skip to content
Devix Open Source

Reference

Developers

Filters

Filter Arguments
devix_phone_field_config array $config Browser options for every field: options (any Phone Input option), strings, cf7Tel
devix_phone_field_reason Reason $reason, PhoneNumber $number, string $value Change the verdict: allow a test number, block a region
devix_phone_field_message string $message, Reason $reason Wording of each validation message
devix_phone_field_stored_value string $formatted, PhoneNumber $number The saved form of a valid number
use DevixPhoneField\Lib\Phone\Reason;

// Accept the store's test number even though it's unassigned.
add_filter( 'devix_phone_field_reason', function ( Reason $reason, $number, string $value ) {
    return $number->e164() === '+97140000000' ? Reason::Valid : $reason;
}, 10, 3 );

// Save as E.164 without the plus.
add_filter( 'devix_phone_field_stored_value', fn ( $formatted, $number ) => ltrim( (string) $number->e164(), '+' ), 10, 2 );

Validating in your own code

$result = \DevixPhoneField\Plugin::instance()->validator->check( $_POST['phone'] ?? '', 'AE' );
// [ 'valid' => true, 'value' => '+971 50 123 4567', 'e164' => '+971501234567', 'country' => 'AE', 'reason' => 'valid', 'message' => '' ]

The underlying PhoneNumber class is the one from Laravel Phone, bundled under the DevixPhoneField\Lib\Phone namespace. It offers formats, types, masking and WhatsApp links.

Any input

  • [devix_phone name="phone" country="gb" preferred="gb,ie" mobile="1" required="1"]
  • <input type="tel" name="phone" class="devix-phone">
  • <input type="tel" name="phone" data-devix-phone='{"initialCountry":"PK","allowedTypes":["mobile"]}'>

The script finds fields added later too, such as AJAX-loaded forms and popups. For your own server-side check, use the validator above.

Assets

  • Loading: the scripts load as an ES module (wp_enqueue_script_module), only on checkout, My Account and pages with a phone field.
  • Bundled files: Phone Input's files are in assets/vendor/phone-input, with its licence and VERSION.
  • Style handles: devix-phone-input and devix-phone-field, if you need to dequeue or extend them.
Updated 12 Sep 2026