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

January 8, 2024
Roadway Worker Memorial Scholarships can help fuel dreams

Students urged to apply by Feb. 15 for up to $11,000 in aid for education When a roadway worker is…

November 29, 2023
Giving Tuesday breaks record for Foundation support

In a year in which households across the nation are struggling due to the rising costs of necessities, ATSS Foundation…

April 4, 2023
3M pledge wall raises more than $14K for ATSS Foundation

This year’s 3M pledge wall raised $14,820 for The ATSS Foundation. This was the seventh year 3M has operated the virtual wall fundraiser, which ran from the start of the year through the end of ATSSA’s Convention & Traffic Expo. 3M launched the event with an offer to match up to $5,000 in donations. When the tally fell just short of that figure—at $4,820—the company elected to provide the full match. Those funds plus 3M’s $5,000 sponsorship provided The Foundation with a total of $14,820. ATSS Foundation Vice Chair Peter Johnston stands in front of the 3M Pledge Wall on the Traffic Expo floor during ATSSA's 2023 Convention & Traffic Expo in Phoenix in February. This year’s 3M pledge wall raised $14,820 for The ATSS Foundation. This was the seventh year 3M has operated the virtual wall fundraiser, which ran from the start of the year through the end of ATSSA’s Convention & Traffic Expo. 3M launched the event with an offer to match up to $5,000 in donations. When the tally fell just short of that figure—at $4,820—the company elected to provide the full match. Those funds plus 3M’s $5,000 sponsorship provided The Foundation with a total of $14,820. “We are grateful for 3M’s support of The Foundation through this fundraiser for seven years running,” said Foundation Director Lori Diaz. “We appreciate the company’s commitment and its generosity in donating the full match amount.  Our generous donors make a difference in educating people about roadway safety and in the lives of people affected by roadway tragedies.” The ATSS Foundation is the charitable arm of ATSSA and exists to promote roadway safety through charitable giving and public awareness programs.