[WordPress] 外掛分享: Full State Name for Gravity Forms

首頁外掛目錄 › Full State Name for Gravity Forms
WordPress 外掛 Full State Name for Gravity Forms 的封面圖片
全新外掛
安裝啟用
尚無評分
6 天前
最後更新
問題解決
WordPress 5.8+ PHP 7.4+ v1.0.2 上架:2026-05-19

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Full State Name for Gravity Forms」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Full State Name for Gravity Forms fixes an annoying inconsistency in Gravity Forms: depending on the form, the add-on, and the code path, the Address field’s “State / Province” sub-input (input X.4) sometimes resolves to a 2-letter abbreviation (“NJ”) and sometimes to the full state name (“New Jersey”) when used in merge tags.
This causes real problems with:

Notification emails that read “Your shipment is going to NJ.”
{all_fields} output mixing full city names with state codes.
URL query strings that pre-populate another Gravity Form — the second form’s state dropdown doesn’t match “NJ” against its option value of “New Jersey”, so the field stays blank.

The Solution
This plugin hooks into gform_merge_tag_filter and, only when the merge tag targets an Address field’s State sub-input (X.4) and the value is exactly a 2-letter code, expands it back to the full state name that Gravity Forms uses in its Address field dropdown.
Key Features

Targeted — Only affects Address field State sub-inputs (X.4), nothing else
Safe — Only acts when the value is exactly two letters; existing full names and other text pass through untouched
Zero Configuration — Activate the plugin and the fix is live
Filterable — Override or extend the code-to-name map with the fsn_gf_state_map filter for non-US addresses or translated labels
Filterable expansion — Hook fsn_gf_expanded_state_name to customize the replacement on a per-field basis

Where It Applies

{all_fields} merge tag
{Address (State / Province):X.4} merge tag
Notifications, confirmations, and any place merge tags are processed
URL query strings built with merge tags (so the receiving form’s state dropdown picks the correct option)

Covered Codes
All US states (50), DC, US territories (PR, GU, VI, AS, MP), and military mailing regions (AA, AE, AP) — a total of 59 entries that match the default Gravity Forms Address state options exactly.

延伸相關外掛

文章
Filter
Mastodon