Plugins FAQ Docs Support Contact See the plugins

Restrict part of a page with the shortcode

The [content_gate] shortcode hides part of an otherwise public page. Put the reserved text between [content_gate] and [/content_gate]: visitors who do not match see nothing, or the message you choose.

How to add it

  1. Open the page for editing.
  2. In the block editor, add a Shortcode block (click + and search for "Shortcode"). In the classic editor, type directly in the text.
  3. Type the shortcode with your content in the middle, for example:
    [content_gate who="logged_in"]Reserved paragraph.[/content_gate]
  4. Click Update or Publish.

Attributes

AttributeValuesDefaultWhat it does
whologged_in, logged_out, roleslogged_inWho can see the content.
rolesRole names separated by commas, e.g. editor,authoremptyUsed with who="roles". Pro.
devicesdesktop, mobile, or both separated by a commaempty (every device)Shows the content only on those devices. Pro.
messageAny textemptyWhat others see. Without it, the content simply disappears for them.

Examples

  • Only for logged in users:
    [content_gate who="logged_in"]Reserved paragraph.[/content_gate]
  • Only for editors and authors (Pro):
    [content_gate who="roles" roles="editor,author"]Internal note.[/content_gate]
  • A sign-up button only for visitors who are not logged in, with a message for everyone else:
    [content_gate who="logged_out" message="You already have an account."]Sign up[/content_gate]

Role names

In roles use the role's internal name in lowercase: administrator, editor, author, contributor, subscriber. Roles added by other plugins have their own name (WooCommerce, for example, adds customer).

In the free version

The shortcode works in the free version with logged_in and logged_out. who="roles" is applied as "logged in users" and devices is ignored until a licence is active.

Administrators always see the content between the tags, even with who="logged_out". Check the result in a private browser window.

Still stuck?

Write to us and tell us which plugin, what you tried and what you see. We answer from Italy, usually within one working day.

webadmin@nopvideo.com