Purpose

The [protect-content] shortcode can be used to show or hide small sections of content based on role or status.

Usage

It has three parameters:

operation
Whether to show or hide the content if the conditions are met. Valid values: show or hide (default: show)
role
Which role(s) to require or forbid. Valid values: the internal name of any role (e.g. administrator, non-member, etc.), comma-separated if more than one (default: null)
status
Which status to require or forbid. Valid values: logged-in or logged-out (defaults to null)

Examples

Each code example is followed by the actual shortcode, but you’ll only see it if you meet the conditions.

Show content if conditions are met

[protect-content role="editor"]This content is only shown to Administrators and Editors.[/protect-content]
Result
[protect-content role="author"]This content is only shown to Administrators and Authors.[/protect-content]
Result
[protect-content role="contributor"]This content is only shown to Administrators and Contributors.[/protect-content]
Result
[protect-content role="member"]This content is only shown to Administrators and Members.[/protect-content]
Result
[protect-content role="subscriber"]This content is only shown to Administrators and Subscribers.[/protect-content]
Result
[protect-content status="logged-in"]This content is only shown to logged-in users.[/protect-content]
Result

Hide content if conditions are met

[protect-content operation="hide" role="editor"]This content is hidden from Editors.[/protect-content]
Result
This content is hidden from Editors.
[protect-content operation="hide" role="author"]This content is hidden from Authors.[/protect-content]
Result
This content is hidden from Authors.
[protect-content operation="hide" role="contributor"]This content is hidden from Contributors.[/protect-content]
Result
This content is hidden from Contributors.
[protect-content operation="hide" role="members"]This content is hidden from Members.[/protect-content]
Result
This content is hidden from Members.
[protect-content operation="hide" role="subscriber"]This content is hidden from Subscribers.[/protect-content]
Result
This content is hidden from Subscribers.
[protect-content status="logged-out"]This content is only shown to visitors who aren't logged in.[/protect-content]
Result
This content is only shown to visitors who aren’t logged in.

Lorem Ipsum

Lorem Ipsum

Related News Articles

July 24, 2024
ATSS Foundation Receives 2024 ASAE Power of Associations Silver Award

NEWS RELEASE Contact: Maria Robertson ATSSA Director of Marketing & Communications communications@atssa.com   ATSS Foundation Receives 2024 ASAE Power of…

June 10, 2024
Foundation awards 12 Roadway Worker Memorial Scholarships for 2024-2025

Foundation awards 12 Roadway Worker Memorial Scholarships for 2024-2025 Winners include four new recipients, two Chuck Bailey Memorial Scholarships The…

May 29, 2024
Changes in store for ATSSA’s 2025 Convention & Traffic Expo

Changes in store for ATSSA’s 2025 Convention & Traffic Expo Check out innovative plans for ATSSA’s event in Orlando, Fla….