id, 'ageverif')) { remove_all_actions('admin_notices'); remove_all_actions('all_admin_notices'); } } // Register plugin menu/submenus in the WordPress admin area public function register_menu(): void { add_menu_page( __('AgeVerif', 'ageverif'), __('AgeVerif', 'ageverif'), 'manage_options', 'ageverif', [$this, 'render_getting_started_page'], $this->get_menu_icon(), 58 ); add_submenu_page( 'ageverif', __('Getting Started', 'ageverif'), __('Getting Started', 'ageverif'), 'manage_options', 'ageverif', [$this, 'render_getting_started_page'] ); add_submenu_page( 'ageverif', __('Plugin Settings', 'ageverif'), __('Plugin Settings', 'ageverif'), 'manage_options', 'ageverif-settings', [$this, 'render_settings_page'] ); add_submenu_page( 'ageverif', __('Frequently Asked Questions', 'ageverif'), __('FAQ', 'ageverif'), 'manage_options', 'ageverif-faq', [$this, 'render_faq_page'] ); } // Get the menu icon for the plugin private function get_menu_icon(): string { $icon_path = AGEVERIF_PATH . 'assets/img/favicon.svg'; if (is_readable($icon_path)) { $svg = file_get_contents($icon_path); if (is_string($svg) && $svg !== '') return 'data:image/svg+xml;base64,' . base64_encode($svg); } return ''; } public function register_settings(): void { register_setting( 'ageverif_settings_group', 'ageverif_settings', [$this, 'sanitize_settings'] ); } public function enqueue_assets(string $hook): void { if ( ! str_contains($hook, 'ageverif')) return; wp_enqueue_style( 'ageverif-admin', AGEVERIF_URL . 'assets/css/admin.css', [], AGEVERIF_VERSION ); wp_enqueue_script( 'ageverif-admin-settings', AGEVERIF_URL . 'assets/js/admin-settings.js', [], AGEVERIF_VERSION, true ); } // Helper function to sanitize and validate input settings public function sanitize_settings(mixed $input): array { // WordPress may pass null or a scalar here (e.g. update_option() called elsewhere) if (! is_array($input)) $input = []; $defaults = ageverif_default_settings(); $current_settings = get_option('ageverif_settings', []); if (! is_array($current_settings)) $current_settings = []; $output = array_merge($defaults, $current_settings); if (array_key_exists('website_key', $input)) $output['website_key'] = sanitize_text_field((string) $input['website_key']); if (array_key_exists('display_mode', $input)) { $mode = sanitize_text_field((string) $input['display_mode']); $allowed_modes = ['all', 'include', 'exclude']; $output['display_mode'] = in_array($mode, $allowed_modes, true) ? $mode : 'all'; } if (array_key_exists('url_patterns', $input)) $output['url_patterns'] = $this->sanitize_url_patterns($input['url_patterns']); $output['enabled'] = ! empty($input['enabled']) ? 1 : 0; if (array_key_exists('admin_mode', $input)) { $admin_mode = sanitize_text_field((string) $input['admin_mode']); $allowed_admin_modes = ['everyone', 'admins_only', 'skip_admins']; $output['admin_mode'] = in_array($admin_mode, $allowed_admin_modes, true) ? $admin_mode : 'skip_admins'; } return $output; } // Helper function to sanitize and validate URL patterns private function sanitize_url_patterns(mixed $value): array { if (is_array($value)) $value = implode("\n", array_map(static fn(mixed $v): string => is_scalar($v) ? (string) $v : '', $value)); $lines = preg_split('/\r\n|\r|\n/', (string) $value); if (! is_array($lines)) return []; $patterns = []; foreach ($lines as $line) { $pattern = trim(wp_unslash((string) $line)); if ($pattern === '') continue; $patterns[] = sanitize_text_field($pattern); } return array_values(array_unique($patterns)); } // Render common admin header private function render_admin_header(): void { ?>
To use the AgeVerif plugin, you need to have a valid 🟢 Public Live Key from our Webmasters Platform. If you don't have one yet, please follow these steps:
Having issues with the plugin integration? Click here to see common issues and their solutions
render_admin_footer(); ?>No, the
checker.jsscript is designed to be SEO-friendly and allows search engines and AI bots like Google, ChatGPT, and Facebook to crawl and index your website. The age verification flow is not displayed to trusted bots, ensuring your content remains discoverable in search results while still enforcing age verification for regular visitors.
No, this plugin uses the Checker Script (SDK) integration, each website must have its own 🟢 Public Live Key.
However, the key works on all subdomains of the same root domain.E.g. A key configured for
example.orgwill work onwww.example.organdanother.example.org.
If you have many websites, perhaps the OAuth2 integration is a better fit, allowing you to use the same client credentials with different redirect URIs for each website or handle the redirection logic on your side via the
stateparameter.
The duration a visitor is considered verified depends on their country's jurisdiction, for more information please refer to our Compliance and Policies.
Yes, you can see the Checker in action on our demo website: https://demo.ageverif.com
Additional questions? Check our Plugin Documentation or contact us through support@ageverif.com
render_admin_footer(); ?>