A lightweight WordPress cookie consent banner for strictly necessary cookies only. Built specifically for 84em.com and sites that use only essential cookies (Cloudflare, security, functionality).
- Simple & Lightweight: ~2KB minified JS, ~1.8KB minified CSS
- No Dependencies: Pure JavaScript, no jQuery or external libraries
- Strictly Necessary Only: Simple consent for essential cookies only
- Accessibility: Full keyboard navigation, ARIA labels, focus management
- Performance: Minified assets with source maps, lazy loading
- Privacy-First: No tracking, no analytics, no marketing cookies
- Run
./build.shto create the plugin ZIP - Go to WordPress Admin → Plugins → Add New
- Click Upload Plugin
- Choose
84em-consent-{version}.zip - Click Install Now and activate
- Upload the
84em-consentfolder to/wp-content/plugins/ - Activate through the WordPress admin
Customize the banner via the 84em_consent_simple_config filter:
add_filter('84em_consent_simple_config', function($config) {
$config['brand_name'] = '84EM';
$config['accent_color'] = '#D45404';
$config['banner_text'] = 'We use only essential cookies for security and performance.';
$config['policy_url'] = '/privacy-policy/';
$config['cookie_version'] = '2025-09-13';
$config['cookie_duration'] = 180; // days
$config['show_for_logged_in'] = false;
return $config;
});# Install dependencies (first time only)
npm install
# Build minified assets
npm run build
# Create installable WordPress plugin ZIP
./build.sh
# Development mode (auto-rebuild on changes)
npm run dev84em-consent/
├── 84em-consent.php # Main plugin file
├── assets/
│ ├── consent.css # Source CSS
│ ├── consent.js # Source JavaScript
│ ├── consent.min.css # Minified CSS (generated)
│ └── consent.min.js # Minified JavaScript (generated)
├── build.sh # Build script for creating ZIP
├── package.json # Node dependencies
└── README.md # This file
// Check if user has given consent
if (function_exists('e84_has_consent') && e84_has_consent()) {
// User has accepted cookies
}// Check consent status
if (window.e84ConsentAPI && window.e84ConsentAPI.hasConsent()) {
// User has accepted
}
// Listen for consent
document.addEventListener('84em:consent:accepted', function(e) {
console.log('Consent given:', e.detail);
});
// Reset consent (for testing)
window.e84ConsentAPI.resetConsent();- Name:
84em_consent - Purpose: Store consent acceptance
- Duration: 180 days (configurable)
- Data: JSON with accepted status, version, timestamp
- Modern browsers (Chrome 90+, Firefox 88+, Safari 14+)
- Mobile browsers (iOS Safari, Chrome Mobile)
- Graceful degradation for older browsers
Andrew Miller @ 84EM - https://84em.com/
This project is licensed under the MIT License - see the LICENSE file for details.