Auto Age Gate (No Button) — Per Tab Session (Front-End Only + Editor Safe)
A collection of reusable custom code snippets and hooks for WordPress and WooCommerce projects.
by MTS Developers · github.com/sabuj71/wp-custom-snippets · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/sabuj71/wp-custom-snippets/archive/refs/heads/main.zipAuto Age Gate (No Button)
A super-lightweight age verification overlay that auto-submits with MM/DD/YYYY fields—no button required. Persists via localStorage.
Description
- Shows a full-screen overlay asking for MM/DD/YYYY.
- Auto-focuses through fields and verifies once complete.
- Stores a
verified=trueflag in localStorage so returning users skip the gate. - Adds
age-verifiedclass to<body>when verified. - Can be disabled on specific pages via the filter
auto_age_gate/disabled.
Installation
- Upload the ZIP via Plugins → Add New → Upload Plugin.
- Activate Auto Age Gate (No Button).
- Visit your site (in an incognito window) to test the overlay.
Developer
Disable the gate via a filter:
add_filter('auto_age_gate/disabled', '__return_true'); // disables globally
Or conditionally:
add_filter('auto_age_gate/disabled', function($disabled){
if (is_user_logged_in() || is_page('privacy-policy')) return true;
return $disabled;
});
Changelog
1.0.0
- Initial release.