Age verification in WordPress
A legal-age check window for a wine shop or brewery, accessible, remembered for the session and with the French Evin law notices.
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, Vérification de l’âge
* Description: Une fenêtre de vérification de majorité pour caviste ou brasserie, accessible, mémorisée pour la session et accompagnée des mentions de la loi Évin. Ajoute la composition « Vérification de l’âge » à 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-modale-verification-age
*<!-- wp:html -->
<div class="mva" data-mva>
<header class="mva-shop">
<p class="mva-brand">Cave Saint-Vincent · Beaune</p>
<h2 class="mva-h2">Sélection du mois : les bourgognes de vignerons indépendants</h2>
<p class="mva-p">Douze domaines de la Côte de Beaune et de la Côte de Nuits, à partir de 14 € la bouteille, livrés en 48 h.</p>
</header>
<p class="mva-evin">L’abus d’alcool est dangereux pour la santé, à consommer avec modération.</p>
<dialog class="mva-dialog" aria-labelledby="mva-titre" aria-describedby="mva-texte" data-mva-dialog>
<div data-mva-ask>
<p class="mva-logo">Cave Saint-Vincent</p>
<h2 class="mva-title" id="mva-titre">Avez-vous 18 ans ou plus ?</h2>(() => {
if (!document.querySelector(".mva")) return;
document.querySelectorAll("[data-mva]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const KEY = "forge-mva-majeur";
const dialog = root.querySelector("[data-mva-dialog]");
let confirmed = false;
try {
confirmed = sessionStorage.getItem(KEY) === "oui";
} catch {
confirmed = false;
}:root {
--mva-bg: #f7f1ec;
--mva-text: #2a1519;
--mva-muted: #5c4448;
--mva-card: #fffdfb;
--mva-line: #d9c4c8;
--mva-accent: #7f1d3a;
--mva-accent-text: #ffffff;
--demo-modale-verification-age-bg: #efe6e1;
--demo-modale-verification-age-text: #2a1519;
}
Free component: copy it freely, including for commercial projects.
Other modals components in WordPress
Modals components in WordPress
A search covering the page, with popular suggestions, opened from the navigation bar.
- Tailwind
- React
- CSS
- WordPress

A short form in a window to request a call from an advisor.
- Tailwind
- React
- CSS
- WordPress

A small window asking to confirm an action before running it.
- Tailwind
- React
- CSS
- WordPress