Newsletter unsubscribe form in WordPress
An honest unsubscribe page: address prefilled from the link, choice between stopping everything or receiving less, optional reason and an undo.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<?php
/**
* Plugin Name: Forge, Formulaire de désinscription newsletter
* Description: Une page de désinscription honnête : adresse préremplie depuis le lien, choix entre tout arrêter ou recevoir moins, motif facultatif et annulation possible. Ajoute la composition « Formulaire de désinscription newsletter » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-formulaire-desinscription-newsletter
*<!-- wp:html -->
<form class="fdn" data-fdn novalidate aria-labelledby="fdn-titre">
<h2 class="fdn-title" id="fdn-titre">Gérer vos e-mails</h2>
<div class="fdn-field">
<label class="fdn-label" for="fdn-email">Adresse e-mail</label>
<input class="fdn-input" id="fdn-email" name="email" type="email" autocomplete="email" aria-describedby="fdn-err-email">
<p class="fdn-error" id="fdn-err-email" data-fdn-error="email"></p>
</div>
<fieldset class="fdn-fs">
<legend class="fdn-legend">Que souhaitez-vous ?</legend>
<label class="fdn-option"><input class="fdn-radio" type="radio" name="choix" value="tout" checked>Me désinscrire de toutes les lettres</label>
<label class="fdn-option"><input class="fdn-radio" type="radio" name="choix" value="mensuel">Recevoir seulement le récapitulatif mensuel</label>(() => {
if (!document.querySelector(".fdn")) return;
document.querySelectorAll("[data-fdn]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const email = root.querySelector('[name="email"]');
const choices = [...root.querySelectorAll('[name="choix"]')];
const reasons = [...root.querySelectorAll('[name="motif"]')];
const reasonBox = root.querySelector("[data-fdn-reasons]");
const other = root.querySelector("[data-fdn-other]");
const detail = root.querySelector('[name="precision"]');
const submit = root.querySelector("[data-fdn-submit]");
const done = root.querySelector("[data-fdn-done]");:root {
--fdn-card: #ffffff;
--fdn-text: #1d2224;
--fdn-muted: #4f5a5e;
--fdn-accent: #0e6470;
--fdn-line: #cbd6d8;
--fdn-soft: #e8f4f5;
--fdn-error: #b42318;
--demo-formulaire-desinscription-newsletter-bg: #e7eeef;
--demo-formulaire-desinscription-newsletter-text: #1d2224;
}
Free component: copy it freely, including for commercial projects.
Other forms and inputs components in WordPress
Forms and inputs components in WordPress
A quote request form for tradespeople: the customer describes the work, picks a start date range and attaches up to six site photos, each with a preview, its size and a button to remove it.
- Tailwind
- React
- CSS
- WordPress

A quote request form whose labels, hints and error messages are full French sentences, still readable at 320 px: nothing overflows, nothing is cut off, and each error is tied to its field.
- Tailwind
- React
- CSS
- WordPress

Visitors pick a package and tick options: the pre-tax total, VAT and total including tax update live, and the summary is sent with the contact form.
- Tailwind
- React
- CSS
- WordPress

A short NPS survey: a 0 to 10 score as radio buttons, then a follow-up question adapted to whether the customer is a detractor, passive or promoter.
- Tailwind
- React
- CSS
- WordPress

A callback request form: French phone number checked and formatted, topic, working day and time slot, with explicit consent to the call.
- Tailwind
- React
- CSS
- WordPress

A SIRET or SIREN field that checks the Luhn key as you type, handles the La Poste exception, formats the number and links to the official business directory.
- Tailwind
- React
- CSS
- WordPress