How to Age-Restrict Content in WordPress (Elementor, Gutenberg and Shortcode)
You do not have to lock your whole site behind an age popup. This guide shows how to hide a video, a product section or a download until the visitor verifies their age, using an Elementor widget, a Gutenberg block or a shortcode.
Short answer: you can hide only part of a page until the visitor verifies their age. Wrap the content in an Age-restricted content block in Gutenberg, an Age-restricted content widget in Elementor, or the [age_restricted] shortcode anywhere else. Everyone can read the page; only the restricted part asks for an age check.
A site-wide age popup is the right choice when everything you publish is 18+. But many sites mix general content with a few restricted pieces: a cocktail recipe blog with one video about a spirits brand, a game studio with one mature trailer, or a store with a single page of tobacco accessories. Locking the whole site for those few items costs you visitors on every other page.
When to restrict part of a page
- Mature video or trailer on an otherwise general page.
- Product details or price lists for restricted items, while the rest of the catalog stays open.
- Downloads such as menus, wine lists or brochures for 18+ products.
- Landing pages where you want the headline and story visible to everyone, including search engines, and only the offer behind the check.
The other option is per-page control: show the gate on some pages and never on others. You can combine both.
Method 1: Gutenberg block
- Open the page in the block editor and click +.
- Search for Age-restricted content and add the block.
- Put any blocks inside it: text, images, video, buttons, columns.
- In the block settings, change the message and button text if you like, for example “Please verify your age to watch this video”.
- Update the page and open it in a private window to test.
Visitors who have not verified see your message and a Verify my age button in place of the content. After they pass the check, the content appears.
Method 2: Elementor widget
- Edit the page with Elementor and search the widget panel for Age-restricted content.
- Drag the widget into the section you want to protect.
- Add your content in the Content for verified visitors editor.
- Under Before verification, set the message and the button label.
- Publish and test in a private window.
Inside the Elementor editor the widget shows as a dashed box, so you can always see and edit the hidden content.
Method 3: Shortcode (classic editor and other builders)
Wrap any content in the shortcode:
[age_restricted message="Please verify your age to watch this video." button="Verify now"]
Your age-restricted content here
[/age_restricted]
Both attributes are optional. The shortcode works in classic posts, text widgets and most page builders.
Open the age gate from any button
Sometimes you want the visitor to choose when to verify, for example a “Shop 18+ range” button in your menu. Add the CSS class avp-trigger-manual to any link, menu item or Elementor button and it will open the age gate when clicked.
Per-page control: show, hide or force the gate
Every page, post and WooCommerce product has an Age verification box in the editor sidebar with three options:
| Option | What it does | Use it for |
|---|---|---|
| Default | Follows your site-wide settings | Most pages |
| Strict | Hides the content on the server until the visitor passes the check | Pages that must stay hidden from unverified visitors |
| Never show the age gate | No popup on this page | Privacy policy, terms, contact, landing pages |
Excluding your legal and contact pages is a good habit: visitors and payment providers can always read them, and search engines see them without a popup.
Make it tamper-proof
A gate that only hides content with CSS can be bypassed by anyone who opens the browser tools. For content that must not leak:
- Use Strict on the page so the content is removed on the server until the visitor is verified.
- Turn on Strict server-side verification in the Security tab. The verification cookie is then signed, so it cannot be faked in the browser.
- Exclude pages from your cache only if you see problems. The plugin already marks visitor-specific pages as not cacheable. See Age Verification Popup and Page Cache.
SEO tips for partly restricted pages
- Keep the headline, introduction and images outside the restricted area so the page still has content to rank.
- Let search engines crawl without the popup. Advanced Age Verification Pro recognises real Google and Bing crawlers by their IP address. More in Does an Age Verification Popup Hurt SEO?
- Do not redirect unverified visitors to another URL. Show the message on the same page.
Get the block, widget and shortcode
The Age-restricted content block, Elementor widget, shortcode, per-page Strict mode and signed cookies are part of Advanced Age Verification Pro. Full setup details are in the age-restricted content documentation.
Frequently asked questions
Can I age-restrict one section of a page instead of the whole site?
Yes. Wrap the section in the Age-restricted content block (Gutenberg), the Age-restricted content widget (Elementor) or the [age_restricted] shortcode. Visitors who have not verified see a message and a Verify my age button instead of the content.
Is the hidden content still visible in the page source?
With Strict mode on, the content is removed on the server until the visitor has passed the check, so it is not in the page source. With Strict server-side verification on, it only unlocks with a signed cookie that cannot be faked in the browser.
Can I turn the age gate off for one page?
Yes. Every page, post and product has an Age verification box in the editor sidebar. Choose Never show the age gate for pages like your privacy policy, terms or contact page.
Does it work with other page builders?
The shortcode works in classic posts, widgets and most page builders. There is also a CSS class, avp-trigger-manual, that opens the age gate from any button or menu item.