1.7.0
What’s Changed
- New: Geolocation targeting. Any link can route visitors to a different destination based on their country, with rules evaluated in order and the first country match winning.
- New: Country detection with zero dependencies. The country is read from request variables your CDN or web server already provides — Cloudflare (
CF-IPCountry), CloudFront, Vercel, Google App Engine, nginx GeoIP2, Apache mod_geoip, mod_maxminddb, or a custom header you name. No GeoIP database file, no third-party API, no outbound request. - New:
EUcountry group expands to all 27 member states in a single rule; extendable viagtlm_geo_country_groups. - New: Per-rule status codes, and a “show a 404” fallback for visitors matching no rule.
- New: Geolocation settings section with a live “Detected Now” readout showing which country and source resolved for the current request — the fastest way to confirm your CDN is forwarding a country header.
- New: “Check Detection” button. Lists every country header present on the request with its raw value, and runs a loopback self-test — it sends the site a request carrying a country header and reports what the plugin detected at the other end. That proves detection works even on a local or staging install with no CDN in front, where “no country on this request” is correct rather than a fault. Also validates a country code you type before you use it in a rule.
- New: The detection readout distinguishes “nothing is proxying this site, so no country is expected” from “your CDN is in front but sent no country header” — only the second is a misconfiguration, and it now says how to fix it.
- New: Rule builder in the link editor. Numbered rows show match precedence, rules can be reordered, one-click picks cover common markets (US + CA, EU, UK, India, AU + NZ), the long country list is filterable, selections show as removable chips, and the “Everyone else” fallback reads as the final row. It warns when a country is listed twice (only the highest rule can ever match) or when a rule has countries but no URL.
- New: Rule preview. Pick a country and see exactly which rule wins and where it sends — evaluated in the browser against your unsaved edits, with no request made.
- New: Privacy disclosure. The plugin registers a suggested privacy-policy section under Settings → Privacy → Policy Guide, and states inline that country detection reads only a CDN-provided header — never the visitor’s IP address, never an external service, and the country is never stored or logged.
- Fixed: a partial REST update (PATCH) of one field silently reset every field that was not included, because each write argument declared a schema default that WP_REST_Request materialises into the request. Sending only
geo_ruleswould resetredirect_typeto 301 — which quietly breaks geo targeting — and blanktags,notes, andrel. Omitted fields now keep their stored values. Create defaults are unchanged. - New: Optional
X-GTLM-Countrydebug response header showing the detected country, its source, and whether a rule matched. - New: Geo rules are exposed in the REST API on
/links(create, read, update) with a self-describing schema, so links can be geo-targeted programmatically. Postinggeo_ruleswithoutgeo_modeopts the link in automatically. - New: Geo rules round-trip through CSV import and export; a malformed rules cell is dropped without failing the row.
- New: Geo column in the links list table, and geolocation status in Diagnostics.
- Performance: geolocation costs nothing on links that do not use it — the check is a single array read, and country detection is never invoked unless a matched link opts in. Detection and settings are resolved once per request.
- Note: geo-targeted links should use 302, not 301. A 301 is cached by the browser permanently, which pins a visitor to whichever country they were in on their first click. The link editor warns when a geo link is set to 301.
- Note: a country header can be forged on requests that reach your site without passing through your CDN, so the 404 fallback is not a security control. Behind Cloudflare,
CF-IPCountryis rewritten at the edge and cannot be spoofed; the “Cloudflare only” detection method is the strictest setting.
= 1.6.1 = = 1.7.0 = Adds geolocation targeting: route each link by visitor country using the header your CDN already sends — no GeoIP database, no external API, no added latency. Two columns are added to the links table automatically on upgrade; existing links are untouched and keep redirecting exactly as before. Enable it under GT Links → Settings → Geolocation Targeting.
Commits
- Deploy the bare version to WordPress.org, not the tag name (03e7b9f)
- Add geolocation targeting, bump to 1.7.0 (d45326c)
- Add Playground blueprint for wp.org Live Preview (6ea77f0)
Full Changelog: https://github.com/wpgaurav/gt-link-manager/compare/v1.6.1…v1.7.0
