[ms-protect-content]
The [ms-protect-content] shortcode allows course creators to show or hide specific content based on membership level. This makes it possible to restrict lessons, sections of a page, or other content to only certain members.
Parameters
The shortcode accepts the following attributes:
- id (required) – One or more membership IDs. The shortcode applies if the user belongs to at least one of these memberships.
- access (
yes|no) – Defines whether members of the listed memberships can see (yes) or cannot see (no) the content. Default:yes. - silent (
yes|no) – If set toyes, the content is removed completely without showing a message. Default:no. - msg (text) – A custom protection message shown when access is denied. Only works if
silent="no". Default: empty.
Examples
Restrict content to members of a single membership:
[ms-protect-content id="1"]Only members of membership-1 can see this![/ms-protect-content]
Hide content from certain members (IDs 2 and 3), without showing a message:
[ms-protect-content id="2,3" access="no" silent="yes"]Everybody except members of memberships 2 or 3 cImportant Note: Content protection shortcodes only work if content protection is enabled.
Go to MemberDash > Settings > General
Turn on Content Protection
Conclusion
The [ms-protect-content] shortcode is a flexible way to control access to specific content based on membership level. By adjusting attributes such as id, access, silent, and msg, course creators can define exactly who can view or be restricted from content.