WordPress shortcodes
Memberful's WordPress plugin allows you to restrict access to an entire post or page through its Restrict Access meta box. If you want to protect certain parts of the content in a post or page, you can use our shortcodes instead.
In this help doc:
- Access shortcodes via the Memberful editor button.
- Link shortcodes.
- Restrict access with shortcodes.
- Specify multiple plans or downloads.
- Show content to customers who haven't made a purchase yet.
Access shortcodes via the Memberful editor button
This article shows all our shortcodes. The Memberful button in the classic WordPress editor (not available in the new Gutenberg block editor) allows you to add the most common shortcodes to any page or post. Some other shortcodes can only be added manually.
The Memberful button allows you to pre-populate shortcodes with the correct slugs for your plans, downloads, and podcasts, so this is the recommended way to add them to your posts and pages.
Link shortcodes
Link for a member to sign in to their account:
[memberful_sign_in_link]Sign in[/memberful_sign_in_link]
Link for a member to sign out of their account:
[memberful_sign_out_link]Sign out[/memberful_sign_out_link]
Link for a member to see their account profile:
[memberful_account_link]Account[/memberful_account_link]
Link to sign up as a free member:
[memberful_register_link]Sign up for a free account![/memberful_register_link]
Link to buy a plan:
[memberful_buy_subscription_link plan=64879-monthly]Buy Monthly plan[/memberful_buy_subscription_link]
Link to buy a gift:
[memberful_buy_gift_link plan='64879-monthly']Buy the Monthly plan as a gift for someone[/memberful_buy_gift_link]
Link to buy a download:
[memberful_buy_download_link download='123-my-download-slug']Buy Preset pack 1[/memberful_buy_download_link]
Link to a protected download:
[memberful_download_link download="123-my-download-slug"]Download Preset pack 1[/memberful_download_link]
Link to all the podcasts in the member's account:
[memberful_podcasts_link]Access your podcasts[/memberful_podcasts_link]
Deep-link to a specific podcast in a member's account:
[memberful_podcasts_link podcast=5787]Access the podcast[/memberful_podcasts_link]
Display the RSS URL for a member's specific podcast:
[memberful_podcast_url podcast=2]
Link to a member's private WordPress RSS feed:
[memberful_private_rss_feed_link]Your RSS feed[/memberful_private_rss_feed_link]
Restrict access with shortcodes
We recommend using Memberful's Restrict Access meta box to restrict access to content. If you want to protect certain parts of the content in a post or page, you can use shortcodes. You'll first need to fetch the integration slug from your Memberful dashboard. The slug for a plan is shown inside the summary box on the right side of the screen when editing that plan.
The slug for a download is shown at the bottom of the page when editing that download.
Here's a basic example of requiring a subscription to the Big Awesome plan to see the protected content:
[memberful has_subscription_to="154-big-awesome"]
Protected content goes here...
[/memberful]
Require the Super Rad download to see the protected content:
[memberful has_download="27-super-rad"]
Protected content goes here...
[/memberful]
Alternatively, you can restrict the content to members that have a subscription to any plan:
[memberful_if_has_active_subscription]
This will be visible to members that have a subscription to any plan.
[/memberful_if_has_active_subscription]
Show content to customers who haven't yet purchased
If you want to show potential customers a message encouraging them to subscribe to a plan, use the does_not_have_subscription_to
shortcode:
[memberful does_not_have_subscription_to="154-big-awesome"]
Shown to users who haven't purchased the "Big Awesome" subscription.
[/memberful]
Or for a download, use does_not_have_download
:
[memberful does_not_have_download="27-super-rad"]
Shown to users who haven't purchased the "Super Rad" download.
[/memberful]
You can also show content to those that don't have a subscription to any plan:
[memberful_if_does_not_have_active_subscription]
This will only be visible to users that don't have any subscriptions.
[/memberful_if_does_not_have_active_subscription]
Specify multiple plans or downloads
If you want to specify multiple subscription plans or downloads, use a comma separated list.
The following shortcode will show content if the customer is subscribed to any of the plans you specify:
[memberful has_subscription_to="154-big-awesome,277-cool-hair"]
This will only be visible to members who have either the "Big Awesome" subscription, or the "Cool Hair" subscription.
[/memberful]
The following shortcode will show content if the customer owns any of the downloads you specify:
[memberful has_download="27-super-rad,59-rock-on"]
This will only be visible to members who have purchased either the "Super Rad" download, or the "Rock On" download.
[/memberful]
The following shortcode will show content if the customer is not subscribed to any of the plans you specify:
[memberful does_not_have_subscription_to="154-big-awesome,277-cool-hair"]
This will only be visible to members who are neither subscribed to the "Big Awesome" plan nor the "Cool Hair" plan.
[/memberful]
The following shortcode will show content if the customer does not own any of the downloads you specify:
[memberful does_not_have_download="27-super-rad,59-rock-on"]
This will only be visible to members who have neither purchased the "Super Rad" download nor the "Rock On" download.
[/memberful]
Related help docs:
- Restrict access to multiple posts in bulk.
- Restrict access to entire categories or tags.
- Restrict elements of your WP theme.