Restricting Content within a Post or Page

The Restrictions extension comes with two shortcodes which can be used to restrict content within a post or page.

Requiring Users

You may use the [tml-require-user] shortcode in order to require a user to be logged in, or require a specific user to be able to view a piece of content.

In order to require any logged in user to view a specific piece of content, you wrap the content in the shortcode.

Likewise, if you would like to require a specific user by ID, you append id="123" to the shortcode.

Or, if you want to require a specific user by their user login, you append login="someuser" to the shortcode.

If you want to require a specific user by email, you append email="user@domain.com" to the shortcode.

Note that with any of the above examples, multiple values can be set by using the "|" (pipe) character to separate them. For instance, [tml-require-user id="45|22|108"].

Finally, if you would like to display alternate content when the requirement is not met, you would append replace_with="Some other content" to the shortcode.

Requiring Roles

You may use the [tml-require-role] shortcode in order to require a user to have a specific role or roles to view a piece of content.

You can target multiple roles by using the "|" (pipe) character to separate them.

Finally, if you would like to display alternate content when the requirement is not met, you would append replace_with="Some other content" to the shortcode.