skip to Main Content

Restrict Content Shortcodes

Note: This addon requires an Uncanny Automator Plus or Elite license.

Once you have created access levels for using the Restrict Content addon, one way to restrict content in the front end is with the use of shortcodes.

Using a shortcode to restrict content

When you create new access levels from the Automator > Settings > Addons > Restrict Content page, you will see a column for the shortcode related to that access level. Here’s an example:

Copy Restrict Content Shortcodes

Inside the shortcode column, you will see an copy the shortcode out. What you copy out can be added to a WordPress page or post to limit access to certain content. The shortcode will look like this:

[automator_rc access_level=”uarc_gold”]Content to show[/automator_rc]

The shortcode essentially has 3 sections:

  • The initial shortcode tells WordPress to restrict the content that follows to users with the “uarc_gold” access level slug
  • The “Content to show” text should be replaced with whatever you want to protect. This might be a video, another shortcode, text, or anything else
  • The closing [/automator_rc] shortcode tells WordPress where to stop protecting the content.

Advanced shortcode attributes

The shortcode you copy from the Restrict content settings page is easy to use and will be the most common shortcode approach, but there are more attributes available for more advance use cases. Here are some other available attributes:

  • access_level_not=””: When an access level slug is included for this attribute, the protected content will be shown for all logged in users except users with that attribute level. It’s effectively the oppostive of the default access_level=”” attribute.
  • user_field_id=”” value=””: When the Custom User Fields addon is active and these attributes are included, the content will only be shown to users with a matching value in that field ID. If there’s a custom field called “Country” with ID 1, for example, then using [automator_rc user_field_id=”1″ value=”Canada”] is used, then anyone with a country value of “Canada” will see the content. These attributes can also support value_not=”” for the opposite outcome.
  • restriction_message=””: If the user does not meet the criteria to show the content inside the shortcode, the message included in quotes for this attribute will be output on the page.

Knowledge Base Articles

Back To Top