Restrict access to sections of content with the membership shortcode. You can place the shortcode in any post or widget to show a section of content to specific membership levels. Or, use the Membership Required block to get the same functionality if you use the WordPress block editor (Gutenberg).

[membership level="1"]Will only show up for level 1 users.[/membership]

[membership] Shortcode Attributes

This shortcode has two attributes you can use to specify which levels to display the content for as well as an optional “delay” to show the content after a specific timeframe.

  • level: The level ID to show or hide this content from. Accepts “0” for non-members, a single level ID, a comma-separated list of IDs, or a negative value to hide for a specific level. Leave the ‘level’ attribute blank to show the content to all members and hide it from non-member users and visitors.
  • delay: Optionally set a delay in number of days to reveal this content at a future time calculated based on the member’s start date for their active membership level.
  • show_noaccess: Optionally swap content for the appropriate non-member access text as defined under Memberships > Settings > Advanced > Message Settings. Set the attribute to “true” to display the message. The default behavior will not show any swapped message.

Shortcode Examples

[membership]
	Will show up for all members.
[/membership]
[membership level="1" show_noaccess="true"]
	Will only show up for level 1 users.
	Others will see the no access message.
[/membership]
[membership level="1,2,3"]
	Only show for level 1, 2, or 3 users.
[/membership]
[membership level="0,-1"]
	Show for anyone not in level 1, including non-members and visitors.
[/membership]
[membership level="1" delay="7"]
	Will show up for level 1 members, 1 week from their start date.
[/membership]
[membership level="0"]
	Will show up for non-members and non-logged in site visitors.
[/membership]
Was this article helpful?
YesNo