The [protect-content] shortcode can be used to show or hide small sections of content based on role or status.
It has three parameters:
show or hide (default: show)administrator, non-member, etc.), comma-separated if more than one (default: null)logged-in or logged-out (defaults to null)Each code example is followed by the actual shortcode, but you’ll only see it if you meet the conditions.
[protect-content role="editor"]This content is only shown to Administrators and Editors.[/protect-content]
[protect-content role="author"]This content is only shown to Administrators and Authors.[/protect-content]
[protect-content role="contributor"]This content is only shown to Administrators and Contributors.[/protect-content]
[protect-content role="member"]This content is only shown to Administrators and Members.[/protect-content]
[protect-content role="subscriber"]This content is only shown to Administrators and Subscribers.[/protect-content]
[protect-content status="logged-in"]This content is only shown to logged-in users.[/protect-content]
[protect-content operation="hide" role="editor"]This content is hidden from Editors.[/protect-content]
[protect-content operation="hide" role="author"]This content is hidden from Authors.[/protect-content]
[protect-content operation="hide" role="contributor"]This content is hidden from Contributors.[/protect-content]
[protect-content operation="hide" role="members"]This content is hidden from Members.[/protect-content]
[protect-content operation="hide" role="subscriber"]This content is hidden from Subscribers.[/protect-content]
[protect-content status="logged-out"]This content is only shown to visitors who aren't logged in.[/protect-content]