Contact under control: email protection + a smart form
The client raised the problem herself: instead of checking the FAQ or filling in the form, some people clicked straight on the email address and wrote off the cuff โ messages that were incomplete, landing in the wrong place, creating chaos and follow-up questions. We solved it on two fronts: a gentle popup when someone tries to use an email address steers them to the FAQ and the form, and the form itself is smart โ it matches its fields to the chosen topic and routes the request to the right inbox. The result: complete requests reaching the right person straight away.
How it works โ step by step
Attempt to use the email
Someone clicks an email address, copies it or opens the right-click menu.
A gentle popup
A message appears: check the FAQ and use the form โ with a discreet escape hatch, "I still want to write".
Choosing a topic
In the form the user picks the topic of the request (e.g. donation, store โ payment, availability).
Fields adapt
The form shows only the fields relevant to the topic โ e.g. order number, fundraiser link, attachments.
Reaches the right person
The request is routed to the appropriate inbox (e.g. fundacja@ or wniosek@).
A complete request
The team gets all the information at once โ less back-and-forth, a faster response.
What you get
Fewer off-the-cuff emails
The popup steers people to the form, so requests are complete from the start.
Straight to the right person
Topic-based routing sends the message to the appropriate inbox with no manual forwarding.
All the data first time
Conditional fields enforce exactly what is needed for the given matter.
Less work for the team
Less follow-up and manual sorting = faster and cheaper handling.
Security and anti-spam
Safeguards (nonce + honeypot), validation and secure attachment uploads.
Good UX
The user is guided step by step, with an escape hatch for exceptional situations.
Details
Where the idea came from โ the client's observation
The client noticed that many people, instead of reading the FAQ or using the form, clicked straight on the email address and sent incomplete messages. This created chaos: requests missing key data, landing in the wrong inbox and requiring follow-up. The solution was meant to gently change this habit without blocking anyone's path.
How the email protection works
On an attempt to use the address (clicking the link, copying, the right-click menu) a popup appears encouraging the user to check the FAQ and fill in the form, with a discreet escape hatch, "I still want to write". It works globally wherever the addresses appear (FAQ, terms, policy, help) and detects both mailto links and addresses written in plain text.
A smart, topic-dependent form
After choosing a topic, the form shows conditional fields matched to the matter (e.g. an order number for a payment problem, details and attachments for an in-kind donation) and routes the request to the right inbox. It all has validation, spam protection and support for multiple attachments, and after sending you cannot accidentally send it again.
Two modules of one plugin: email-guard (address protection) and a native contact form with conditional fields and inbox routing. Configurable via filters, with no external dependencies.
Email-guard
The module runs on the front end globally (outside the admin). It intercepts a click on a mailto, copying a selected address and the context menu, detecting both links and addresses in plain text. The popup is fully configurable via the cs_email_guard_config filter (URLs and texts), and the whole module can be turned off via the cs_email_guard_enabled filter โ without touching code.
Conditional form
The cs_contact_topics() function is the single source of truth: for each topic it defines the label, the target inbox (fundacja/wniosek) and the conditional fields (types: text, textarea, file, url). The submit handler hooked into template_redirect performs validation, honeypot + nonce, upload of multiple attachments and the PRG pattern (redirect after success), eliminating a resend on refresh.