Country Select & Phone Code for CF7

Description

Country Select & Phone Code for CF7 is a WordPress plugin developed by Bharanidharan M. It provides a country selector and international dialing code input for Contact Form 7 forms.

This plugin provides interactive vector country flags, telephone dial code prefixing, live search filtering, and two-way synchronization directly within Contact Form 7.

All country flags are stored locally within the plugin as vector SVGs. Zero external CDN or network requests are made, ensuring fast page load times and GDPR compliance.

Features

  • Vector SVG Flags: Crisp vector flag icons rendered smoothly across displays without external dependencies.
  • Two-Way Field Synchronization: Selecting a country in the Country dropdown automatically updates the Phone field flag and dialing prefix. Selecting a country in the Phone input synchronizes the Country field instantly.
  • Strict Numbers-Only Phone Validation: Enforces digits-only input by blocking alphabets and invalid characters in real-time on keystroke and sanitizing pasted clipboard text.
  • Automatic Dial Code Merging in Emails: Form submissions automatically prepend the selected country dial prefix (e.g. +91 9876543210) to the phone number in your Contact Form 7 email notification.
  • Dedicated Admin Settings Panel: Configure default countries, preferred countries, country exclusions, and validation settings easily under Contact > Country & Phone Settings.
  • Independent Default Country Controls: Set independent default countries for the Country dropdown and the Phone input to match your regional traffic needs.
  • Preferred Countries Prioritization: Pin your most frequent customer countries (e.g. India, USA, UK, Saudi Arabia, Australia) at the top of the dropdown list for instant access.
  • Instant Live Search: Type-ahead search enables visitors to locate any country quickly by country name, ISO-2 code, or dialing code.
  • Theme-Agnostic Design: Harmonizes with your existing WordPress theme inputs with standard borders and smooth dropdown transitions.
  • 100% Local & Privacy Compliant: All flags and assets are bundled locally with zero external CDN dependencies, ensuring fast performance and GDPR compliance.

Configuration

1. Add Fields to Your Form

  1. Navigate to Contact > Contact Forms and edit your form.
  2. Use the dedicated Country Phone or Country Select tag generator buttons in the editor toolbar, or insert tags manually:
    • Country dropdown: [country_select* your-country]
    • Phone input: [country_tel* your-phone placeholder "Enter your phone number"]
  3. Save your form template.

2. Configure Email Notification

In your Contact Form 7 Mail tab, insert the corresponding mail-tags into your email notification template:
* Custom tag names:
Country: [your-country]
Phone: [your-phone]
* Tag generator auto-generated names:
Country: [country_select-123]
Phone: [country_tel-456]
* Standalone dial code (optional):
Dial Code: [country_code] or [your-phone_country_code]

3. Customize Plugin Settings

Open Contact > Country & Phone Settings to customize:
* Default country for Country selector and Phone input independently.
* Preferred priority countries pinned at the top of the dropdown.
* Exclude specific countries.
* Two-Way Field Synchronization toggle.
* Numbers-only phone validation toggle.
* Automatic dial code email merging toggle.

Installation

  1. Log into your WordPress admin dashboard.
  2. Navigate to Plugins > Add New and search for Country Select & Phone Code for CF7 (or click Upload Plugin and select the ZIP file).
  3. Click Install Now and activate the plugin.
  4. Ensure the companion plugin Contact Form 7 is installed and activated.

FAQ

Does this plugin require Contact Form 7?

Yes. This plugin is an extension for Contact Form 7. You must have Contact Form 7 (v5.0 or higher) installed and activated.

How do I add the country dropdown to my form?

Simply add the tag [country_select* your-country] inside your form template, or click the “Country Select” button above the CF7 form editor to configure and insert the tag automatically.

How does Two-Way Field Synchronization work?

When enabled in admin settings, choosing a country in the Country dropdown will automatically change the country flag and dial code in the Phone input. Conversely, changing the phone flag will automatically synchronize the Country dropdown selection.

Can I enforce Numbers-Only phone input?

Yes. Under Contact > Country & Phone Settings > Phone Field Settings, enable Numbers-Only Restriction. This instantly prevents visitors from typing alphabets or invalid symbols into the phone field and sanitizes pasted phone numbers.

How do the country and phone number appear in submitted emails?

In your Contact Form 7 Mail tab, place Country: [your-country] and Phone: [your-phone] (or match your exact generated tag names like [country_select-123] and [country_tel-456]). The email will arrive with the full country name (e.g. India) and the telephone number formatted with the country dialing prefix (e.g. +91 9876543210). You can also use [country_code] to output just the dialing code separately.

Can I set different default countries for Country and Phone fields?

Yes. You can specify one default country under “Country Field Settings” and a completely independent default country under “Phone Field Settings”.

How do I pin popular countries to the top of the dropdown?

In the Country Field Settings tab, enter your desired 2-letter ISO codes in the “Preferred Countries” input (e.g. in, us, gb, sa, au). Those countries will appear at the very top of the list for quick selection.

Are flag icons loaded from an external CDN?

No. All 230+ country flags are bundled locally within the plugin as clean vector SVGs. No third-party network requests are made, ensuring fast load times and complete GDPR compliance.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Country Select & Phone Code for CF7” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.2

  • Removed WordPress.org directory screenshot assets from plugin ZIP package per review guidelines.

1.0.1

  • Resolved issues reported by WordPress.org Plugin Review Team.
  • Added ‘Requires Plugins: contact-form-7’ header dependency.
  • Enqueued admin styles via WordPress enqueue API and removed direct inline style output.
  • Standardized translation text-domain to ‘country-select-phone-code-for-cf7’ across all tag generator templates.
  • Removed custom update checker and plugins_api interceptor to rely exclusively on WordPress.org repository updates.
  • Removed invalid 404 Plugin URI header.
  • Removed load_plugin_textdomain call in accordance with WordPress.org guidelines.
  • Updated documentation and descriptions to factual specifications.

1.0.0

  • Initial stable release.
  • 230+ local high-definition vector SVG flags bundled with zero external CDN dependencies.
  • Interactive searchable country dropdown tag: [country_select].
  • International phone number input with country flag selector: [country_tel].
  • Intelligent two-way field synchronization between country and telephone fields.
  • Real-time numbers-only keystroke and clipboard paste restriction.
  • Automatic dial code email prefix merging (+91 9876543210).
  • Independent default country selection for Country dropdown and Phone input.
  • Dedicated multi-tab admin settings panel under Contact > Country & Phone Settings.
  • Built-in CF7 tag generators: “Country Phone” and “Country Select”.
  • Full translation readiness with gettext translation template.