Description
CountryCue adds a country dropdown to Contact Form 7. Visitors can select a country manually or correct a suggestion from supported Cloudways GeoIP or a verified direct Cloudflare connection. Labels include calling codes, such as Cyprus (+357), and your notification email receives the final choice.
Cloudways is not required. Manual country selection works on any host that supports WordPress and Contact Form 7, without enabling hosting geolocation. Automatic suggestions are optional and require one of the supported configurations below.
- Manual selection works on any host that supports WordPress and Contact Form 7.
- Optional automatic suggestions use existing hosting headers. No paid geolocation API, API key or GPS permission.
- A visitor’s selection always takes priority over a delayed suggestion.
- Cached pages use a same-origin, uncached request for each visitor’s suggestion.
- Existing telephone fields and raw country values remain unchanged.
- Native select controls, inherited form styling, popup forms and clean resets.
- No early required-field errors caused by automatic country selection. Normal submission validation remains active.
Setup guide
Open the Installation tab for numbered setup instructions. The eight screenshots below show the Form tab, Mail tab, each CountryCue source option and the finished result. Click any screenshot to enlarge it. Cloudways and Cloudflare dashboard steps and official provider guides are included in Installation.
Created by Ali Khavari to solve a practical form problem: suggest a useful country without taking the final choice away from the visitor, and deliver that corrected choice to the person receiving the enquiry.
All features are free. CountryCue is an independent extension; it is not affiliated with Contact Form 7, Cloudways or Cloudflare.
Privacy and external services
Manual selection is the default. No remote request is made by CountryCue on activation. Country detection reads headers already supplied by your hosting/CDN; there is no visitor-IP lookup API.
An optional checkbox permits weekly server-side HTTPS downloads from https://www.cloudflare.com/ips-v4/ and https://www.cloudflare.com/ips-v6/ while direct Cloudflare mode is selected. These plain address lists verify the origin connection. The first scheduled download is approximately five minutes after enabling this option, subject to WordPress cron traffic. Both lists must pass validation before either replaces the cached lists. Failed updates retain the last verified data. Disabling consent or changing provider stops these downloads. Without consent, the bundled verified ranges are used.
These list requests disclose the website server’s IP address and standard HTTP request metadata (WordPress’ default HTTP user-agent may include the site URL) to Cloudflare. They never contain a visitor IP, selected country, form contents or credentials. Cloudflare may log the requests under its own policy.
Cloudflare: https://www.cloudflare.com/privacypolicy/ and https://www.cloudflare.com/website-terms/
Cloudways: https://www.cloudways.com/en/terms.php and https://www.cloudways.com/en/privacy-policy.php
CountryCue sets no cookies, uses no GPS, and creates no submission database. Diagnostic metadata retains only the latest notification check time, detection reason and country code; no visitor IP, name, email or message is stored by this plugin. The submitted country is part of the normal form/email and may be retained by other form-storage plugins. Hosting, CDN and mail-provider logs are outside CountryCue’s control. A suggested privacy-policy paragraph is available through WordPress’ privacy tools.
The country is self-reported and is not proof of location, nationality or residence.
Credits
Copyright 2026 Ali Khavari. CountryCue is distributed under GPL-3.0-or-later; see LICENSE.txt.
Country names are derived from umpirsky/country-list (English), MIT; see COUNTRY-DATA-LICENSE.txt and https://github.com/umpirsky/country-list.
Calling-code data is derived from Google libphonenumber PhoneNumberMetadata.xml, retrieved 2026-09-18. Copyright The Libphonenumber Authors, Apache-2.0; see PHONE-DATA-LICENSE.txt and https://github.com/google/libphonenumber/blob/master/resources/PhoneNumberMetadata.xml. The PHP mapping is an extracted country-to-calling-code subset, not the full phone validation library. The combined distribution uses GPLv3-or-later for Apache-2.0 compatibility; third-party notices and licences are preserved.
Bundled Cloudflare public IP ranges were verified 2026-09-18: https://www.cloudflare.com/ips/.
Screenshots

![Add the email line: in the Mail tab, put Country: [visitor-country] in Message body and Save. Keep your own recipient and sender settings; example.com addresses are placeholders.](https://ps.w.org/countrycue-for-contact-form-7/assets/screenshot-2.png?rev=3706235)






Installation
Follow steps 1-4, choose ONE source in step 5, then test in step 6. The Screenshots gallery on the Details tab follows this same order. Click an image to enlarge it. Example email addresses in the screenshots are placeholders; keep your site’s own working mail settings.
1. Install both plugins
In WordPress, open Plugins > Add Plugin. Install and activate Contact Form 7, then CountryCue for Contact Form 7. Open Settings > CountryCue and keep “Enable country suggestions, calling-code labels and email enrichment” checked.
2. Add the country field — Screenshot 1
Open Contact > Contact Forms, edit the form you use, and select its Form tab. Add the following where the country dropdown should appear, then click Save. Keep your existing name, email and phone fields.
<label>Country
[select* visitor-country class:qhfc-country first_as_label data:qhfc-countries "Select country"]
</label>
Use the complete tag, including the class and data parts. Remove the asterisk from select* only if the field should be optional. Do not replace your entire existing form with the example.
3. Put the final country in your email — Screenshot 2
In the same form, open the Mail tab. Add the following line to Message body, then click Save:
Country: [visitor-country]
Keep your existing To, From, Subject and phone mail tag. Use a valid sender on your own domain. The selected country and calling code will be included in this line. Leave CountryCue’s optional “Append a plain country section” unchecked when using this mail tag.
4. Display the form on your page
If your form is already on a page, use that page. Otherwise copy the shortcode shown at the top of the Contact Form 7 editor, add it to a Shortcode block on a page, and publish or update that page. Open the public page to check the dropdown.
5A. Any compatible host: manual selection — Screenshot 3
Open Settings > CountryCue. Choose “Manual selection only” under Country source, then Save Changes. No hosting geolocation switch, Cloudways account or paid service is needed. Visitors select their country; the email still receives the final choice with its calling code.
For AUTOMATIC suggestions, geolocation must instead be enabled in one of the supported setups below. Activating CountryCue alone does not enable hosting or Cloudflare geolocation. Choose 5B or 5C only when it matches your site.
5B. Cloudways: turn on Geo IP Detection — Screenshot 4
- In Cloudways, select the application that hosts this WordPress site.
- Open Application Settings > General. Enable Geo IP Detection and confirm the change if prompted.
- Back in WordPress, open Settings > CountryCue, select “Cloudways Geo IP Detection”, and Save Changes.
- Read Connection check at the bottom. A recognised country should appear. If the header is missing, ask Cloudways to check GeoIP for this application and its admin-ajax.php requests.
Cloudways’ official GeoIP setup guide explains how to locate the application setting. This mode also applies to Cloudways’ managed Cloudflare add-on. The host must overwrite X-Forwarded-Country with its own trusted value. Do not choose this mode on unrelated hosting just because it offers GeoIP.
5C. Direct Cloudflare with your host — Screenshot 5
- In Cloudflare, select your site’s domain. Open Network and turn IP Geolocation On.
- In DNS > Records, confirm the hostname serving your site is Proxied (orange cloud), so its requests pass through Cloudflare. Check with your host before changing an existing DNS/CDN setup.
- In WordPress, open Settings > CountryCue, select “Cloudflare — verified direct connection”, and Save Changes.
- Read Connection check. CountryCue must verify the original connection is from Cloudflare. A missing or untrusted connection leaves the dropdown for the visitor to choose.
Cloudflare’s official IP Geolocation guide covers its switch. Cloudways is not required. If your server replaces REMOTE_ADDR with the visitor IP, ask your host to expose the original TCP peer in the server variable QH_CF_PEER_ADDR. Never derive it from an untrusted visitor header. Extra proxy layers require host configuration; otherwise use manual mode. Optional weekly Cloudflare range downloads are off by default and need your separate consent.
Other hosting GeoIP services are not automatically supported. A different provider’s geolocation switch alone is not enough; use manual mode unless the direct Cloudflare requirements are met.
6. Test the result — Screenshots 6-8
- Open the public form. In automatic mode, check whether a country is suggested (Screenshot 6).
- Deliberately select a different country, complete required fields and acceptance, then submit.
- Check the received notification: it must contain your final selection, for example Romania (+40), not the original suggestion (Screenshot 7).
- In manual mode, the visitor must choose a country (Screenshot 8). A required empty field should prevent submission.
If there is no suggestion, check the selected source and Connection check; exclude POST requests to wp-admin/admin-ajax.php from caching. VPNs and mobile networks can affect estimates. If the email does not arrive at all, check Contact Form 7’s mail configuration and your site’s mail delivery. CountryCue adds country information; it is not a mail delivery service.
FAQ
-
Do I need Cloudways or hosting geolocation?
-
No. Manual selection works on any compatible WordPress host without geolocation. To suggest a country automatically, use either supported Cloudways Geo IP Detection or a verified direct Cloudflare connection. Cloudflare can be used with another hosting provider when the original-connection requirements above are met. If neither setup is available, visitors still select their country and the notification email still receives their final choice.
-
Why does automatic detection not work on every host?
-
CountryCue reads country information supplied by supported hosting/CDN services; it does not include its own IP-to-country database or call a visitor-IP lookup service. Hosts expose GeoIP information differently, and some expose none. This version recognises the trusted Cloudways country header or a country header from a verified direct Cloudflare connection. Enabling another host’s GeoIP feature alone does not add a supported integration. Manual selection remains available.
-
Does this work with every form builder?
-
No. It requires WordPress and Contact Form 7. It does not support other form builders or non-WordPress sites.
-
Does a calling code change the phone number?
-
No. Calling codes are display labels and email information. The plugin does not format, validate or prepend telephone numbers. Territories missing from the bundled calling-code data keep country-only labels. Some countries share a calling code.
-
Which country goes into the email?
-
[visitor-country] uses the final submitted dropdown choice, including a visitor correction, and adds its calling code. Use this tag for normal notifications.
Optional legacy-compatible tags are
[_qh_selected_country]for the submitted selection,[_qh_country]for the provider’s estimate, and[_qh_country_code]for the estimated two-letter ISO code. These estimates can differ from the submitted selection. -
Will existing email templates change?
-
Automatic appending is off by default. You can opt in to a simple country section in the main notification (Mail). It uses the submitted choice, or the estimate if no recognised choice exists. It never automatically appends to Mail (2). Existing country mail tags prevent duplicate appended sections. Optional numeric form IDs limit email enrichment; dropdowns work wherever their tag is added.
-
Why is my country wrong or not suggested?
-
IP location is an estimate. VPNs, proxies and mobile networks can change it; CountryCue does not detect VPN use. Visitors can correct the result. Confirm your hosting source, check the connection status in Settings > CountryCue, and exclude POST requests to wp-admin/admin-ajax.php from caching. If detection fails, manual selection still works.
-
Does the plugin change validation?
-
Forms containing the country dropdown defer Contact Form 7’s change-time validation until the first submit attempt. Submission validation remains active. Resetting a form restores the initial clean state. CountryCue does not block acceptance checkbox change events.
-
What happens without JavaScript?
-
The server-rendered country list remains usable and Contact Form 7 handles its normal submission. Automatic suggestions and calling codes in the visible dropdown require JavaScript; email calling codes are added on the server.
-
How do I remove the plugin?
-
First remove the dynamic country field from your forms or replace it with static values, and remove its custom mail tags. Deactivation stops its data provider and scheduled task. Deletion removes CountryCue settings, cached ranges and diagnostic metadata, including across multisite. Forms and email templates are never edited automatically.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“CountryCue for Contact Form 7” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “CountryCue for Contact Form 7” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0.0
Initial public release. Editable country selection, calling-code labels and final-choice email output. Optional Cloudways/direct Cloudflare suggestions, safe manual defaults, opt-in address-list downloads, neutral styling and privacy documentation.
