Linux 软件免费装
Banner图

Phone Field with Country Code for Elementor – Flags & Validation

开发者 morkizdigital
更新时间 2026年5月18日 04:08
PHP版本: 7.4 及以上
WordPress版本: 6.9
版权: GPLv2 or later
版权网址: 版权信息

标签

elementor phone number elementor form country code phone field

下载

1.0.4 1.0.5

详情介绍:

Add an international country code dropdown with flags to any Elementor Pro form phone field. Searchable list, WPML-aware error messages, E.164 output, and per-country validation — without the duplicate submissions, broken multi-step navigation, and identical flags that affect similar plugins. Country Code Field Features for Elementor Requirements How This Plugin Fixes Common Country Code Bugs This plugin was built by studying the support threads of every existing country-code plugin in the WordPress.org directory. The concrete fixes over the status-quo: | Known issue in existing plugins | Our behaviour | | --- | --- | | Forms submit twice when country code is active | We never touch the submit pipeline | | Multi-step form "Next" / "Previous" stops working | Same — native navigation preserved | | Pre-filled phone number duplicates the dial code (55…5555…) | We detect E.164 on init and use setNumber() | | Flags all look the same after installing WP-Rocket / LiteSpeed | Inline SVG per country — nothing to strip | | Validation error texts not translatable with WPML | Error strings registered with WPML String Translation + Polylang | | Country list language can't match site language | Locale resolved from WPML/Polylang/WP locale on the server | | Preferred countries / auto-detect paywalled | Both included |

安装:

  1. Install and activate Elementor and Elementor Pro.
  2. Upload this plugin via Plugins → Add New → Upload Plugin, or unzip into /wp-content/plugins/.
  3. Activate.
  4. In the Elementor editor, drop a Form widget on the page, add a Tel field, and toggle Country Code → Show in the field settings.

屏幕截图:

  • Tel field settings inside the Elementor editor — set default country, preferred list, exclude list, strict validation.
  • Searchable country dropdown with per-country flags painted from individual SVGs (cache-plugin safe).
  • Strict mode validation rejecting an invalid phone number for the selected country.

常见问题:

How do I add a country code dropdown in Elementor form?

Install and activate this plugin (it requires Elementor Pro for the Form widget). Open the form in the Elementor editor, edit the Tel field, and toggle Country Code → Show in the field settings. The dropdown, flags, and per-country validation are enabled with a single click — no extra widgets to add and no configuration required to get started.

Does Elementor have a built-in country code field?

No. The Tel field that ships with the Elementor Pro Form widget accepts free-text phone numbers and does not include a country selector, dial code, or per-country validation. This plugin adds those features to the existing Tel field rather than replacing it with a separate widget, so any form you've already built keeps working — you just toggle one setting per Tel field.

How do I validate phone numbers by country in Elementor?

Enable Strict Validation in the Tel field settings. Submissions are blocked client-side when the number does not match the selected country's pattern (for example, a US number with only 8 digits is rejected). An always-on server-side sanity check (digit count and allowed characters) also runs on the elementor_pro/forms/validation/tel action, so the rule cannot be bypassed by disabling JavaScript.

Does this work without Elementor Pro?

No. The Form widget is an Elementor Pro feature, so Elementor Pro is required for this plugin to work.

Does it work with WPML and Polylang?

Yes. The country-list locale is resolved from WPML's ICL_LANGUAGE_CODE or Polylang's pll_current_language() when available, and all validation error strings are registered with WPML String Translation and Polylang's string registry so they appear in their respective translation UIs.

What value gets submitted?

The full E.164 number, e.g. +919876543210. The input is kept in sync on every keystroke and just before submit, so the value Elementor receives is already in international format.

Does it make external HTTP calls?

No. The country list, flags, and validation library are all bundled locally. Auto-detect uses the browser's navigator.language, not an IP lookup — which makes the plugin GDPR-friendly out of the box.

How do I translate the error messages?

Three options:

  1. Use WPML String Translation or Polylang — the strings are registered automatically.
  2. Generate a .po/.mo file in /languages/ using Loco Translate or POEdit.
  3. Override them in code via the pfcc_error_messages filter: add_filter( 'pfcc_error_messages', function( $msgs ) { $msgs[2] = 'Zu kurz.'; return $msgs; } );

Does the country dropdown appear translated too?

Error messages: yes. Country names: English by default in 1.0. You can provide an i18n object at window.intlTelInputI18n_PFCC via a custom snippet to localise them. Bundled i18n packs are planned for 1.1.

Can I use multiple Tel fields on the same page?

Yes — each field is initialised independently.

Does it work with Elementor Popups?

Yes. The dropdown z-index is set to sit above popup backdrops.

更新日志:

1.0.4 1.0.3 1.0.2 1.0.1 1.0.0