Available Shortcodes

What is a shortcode?

Shortcodes are small placeholders you can insert almost anywhere within your WordPress page and post content. When the page is viewed by a visitor, those placeholders get processed and replaced with some dynamically generated content instead. For example, you might have a shortcode that will show the currently logged in user their first name. A shortcode might look like  [mepr-account-info field="first_name"]. When the page that shortcode is on gets viewed by a logged-in user named John Doe. The page would show John in the content where that shortcode had been placed.

Looking for MemberPress Courses shortcodes? Please Click Here.

Video Overview of Shortcodes and How to Use Them in MemberPress

Currently Available Shortcodes

Account Related

[mepr-account-link]

Shows a link to the Account page in MemberPress. It can be used on any page or post.

[mepr-account-form]

Shows the user account information form. This typically isn't used unless you want to show account information somewhere besides the MemberPress Account page that exists by default. This can also be useful for folks using WPML who create separate account pages for each language.

Note: The [mepr-account-info] shortcode only displays the values of the form fields, and not the actual form fields.

Also, keep in mind that MemberPress custom field data can be collected only on the Account or membership registration pages. The shortcode added to your custom pages will not display any custom fields you added to your forms.

[mepr-list-subscriptions status="all"]

Displays a list of the current user's active and inactive subscriptions.

Since MemberPress 1.9.28 version we introduced an optional status attribute. When you remove status like this: [mepr-list-subscriptions] or set it to "all" as you can see above, it will display default current's active and inactive subscriptions. When you set status to "active": [mepr-list-subscriptions status="active"] and you will see current user's active subscriptions. You can also display current user's inactive subscriptions by using "expired" status: [mepr-list-subscriptions status="expired"].

The subscriptions list can be sorted by date: [mepr-list-subscriptions orderby="date"] or title: [mepr-list-subscriptions orderby="title"]. They can be sorted in ascending: [mepr-list-subscriptions orderby="title" order="asc"] or descending order: [mepr-list-subscriptions orderby="title" order="desc"]

[mepr-logout-link]
[mepr-login-link]
The above two shortcodes are both identical. They show login or logout links based on the current user's logged-in status. The login link will direct the user to the MemberPress login page where they can log in. The logout link will log the user out and redirect them to the Logout Redirect URL you have set on your MemberPress Settings page.

[mepr-login-form use_redirect="true"]
Shows a login form on a page or post. It can be used anywhere. When use_redirect = true, MemberPress will redirect the user to the login redirect URL setting located in the MemberPress Settings page.

[mepr-user-file slug="mepr_slug" user_id=""]Link Text[/mepr-user-file] 
Shows a link to view/download the file uploaded by a user. Replace mepr_slug with the slug of the custom field from your MemberPress > Settings > Fields tab. If you omit user_id, it will show the file for the currently logged in user; otherwise it will show the file for the user you specified by user_id.
You don't have to put the closing shortcode tag, but if you do, any text between them will be used as the link text for the file.

[mepr-user-active-membership-titles userid="" message=""]
Shows the members' currently active membership names. If no userid is present, then it'll default to the current member. If the member has more than one active membership, the names will be separated by a comma. Since MemberPress 1.9.38 version we introduced an optional message attribute. It can be used when you want to display a custom message when a user doesn't have any active subscriptions. If you leave it empty, the shortcode will not display any message.

[mepr-account-info field="slug"]
Displays the user meta field, which is chosen by "slug"

Slug Result
full_name John Doe
full_name_last_first Doe, John
first_name_last_initial John D.
last_name_first_initial Doe, J.
first_name John
last_name Doe
user_login johndoe
user_email johndoe@email.com
nickname johndoe
description (aka Biographical info)
mepr-address-one 123 Fake Street
mepr-address-two Apt. 123
mepr-address-city Vidor
mepr-address-state Texas
mepr-address-zip 77662
mepr-address-country USA
mepr_user_message The "Custom MemberPress Account Message" you have defined for the member in their profile
user_registered The date/time the user first joined your site
display_name johndoe
ID The unique ID assigned to the user upon registration. Must be entered as ID, not id.
"Your custom Slug" Any of the Custom Account Field slugs in the MemberPress Settings.

Unauthorized Access Related

[mepr-unauthorized-message]
Shows the unauthorized message wherever this is placed. If you've set MemberPress up to redirect unauthorized visitors to a specific URL, then we recommend using this shortcode on that unauthorized page.

[mepr-show]Content to show in here[/mepr-show]
[mepr-hide]Content to hide in here[/mepr-hide]
Both shortcodes above support if="X" attribute, where "X" can be "loggedin" or "loggedout". Both shortcodes work on whether the user is logged in or logged out and does not care what, if any, Memberships the user has purchased. Examples of this could be: [mepr-show if="loggedin"]You’re logged in, congratulations![/mepr-show][mepr-show if="loggedout"]You’re now logged out![/mepr-show].

[mepr-active {parameters go here - see below}]Content to protect in here[/mepr-active]
Used to show or hide content on pages throughout your site. This shortcode supports the following parameters (parameters marked with * are required. Only one parameter in red below can be applied per shortcode):

Shortcode Parameters Description
rule(s) * If you plan to use a single Rule ID, then set this to rule="X". If you plan to use multiple Rule ID's, then set this to rules="X, XX, XXX". Where X's = the ID's of the Rule(s).  Where to find a Rule's ID?
membership(s) * If you plan to use a single Membership ID, then set this to membership="X". If you plan to use multiple Membership ID's, then set this to memberships="X, XX, XXX". Where X's = the ID's of the Membership(s).  Where to find a Membership's ID?
ifallowed* When set to ifallowed="show", the content in-between is shown to authorized members only. When set to ifallowed="hide", the content is hidden from authorized members.

unauth

Possible Values:
  • message: the user will be shown the unauthorized message when they are not authorized.
  • login: the user will see the login form when they are unauthorized.
  • both: the user will see the  default unauthorized message followed by the login form. NOTE: when set to "message" or "both" AND the rule has a custom unauthorized message, it will display the custom unauthorized message instead of the global one.
  • hide: (or if the paramter is excluded) does not show a message or login and simply hides the content.
unauth_message Use this to override the default unauthorized message. This only applies when the "unauth" attribute above is set equal to "message" or "both".

An  example shortcode using all above attributes might look like the following:
[mepr-active rules="1, 2, 3" ifallowed="show" unauth="message" unauth_message="Download link hidden, please login or purchase a membership to view."]<a href="#">Download Link Here</a>[/mepr-active]

Registration Related

[mepr-group-price-boxes group_id="123"]
Helpful if you want to place content above and below the group pricing boxes. If you're using this on the Group page itself, there's no need to specify a group_id. If you want to use it elsewhere on your site, you will need the group_id attribute on it.

[mepr-membership-link id="0"]Link text in here[/mepr-membership-link]
Shows a link to the Membership identified by "id".

[mepr-membership-access-url id="123"]Link text here[/mepr-membership-access-url]
Uses the Membership access URL set in the "Membership access URL" setting under the Membership Options section. Use this anywhere on your site to give the member a link to the Membership access URL. Membership. id = 123 should be replaced with the ID of your Membership.  Where to find a Membership's ID?

[mepr-membership-registration-form]
Helpful if you want to place content above and below the Membership registration form. It can ONLY be used on the Membership page.

[mepr-membership-registration-form id="123"]
You can use this shortcode on any WordPress page, post, or custom post type to display the membership registration form of a specific membership. Simply replace 123 with your own membership's unique ID. Where to find a Membership's ID? IMPORTANT: When using this, you'll most likely need to also enable the Global CSS option in your MemberPress > Settings > General tab to prevent errors from appearing on the form.  

[mepr-offline-instructions gateway_id="abc-123"]Custom message here.[/mepr-offline-instructions]
This shortcode can be used on your "thank you" pages to display any type of message specific to users who registered via your offline gateway option. For gateway_id="abc-123", enter your gateway's ID. It could be used to provide additional instructions for users when they purchase your membership through your offline gateway. Note: Though we designed this specifically with offline gateways in mind, it can be used successfully with the gateway ID of any other MemberPress supported gateway.

[mepr-ecommerce-tracking]Message with %%variables%% in here[/mepr-ecommerce-tracking]
This shortcode can ONLY be used on the thank you page or in custom thank you page messages. It does not work anywhere else.
It supports the following %%variables%%, which are automatically replaced with values from the purchase.

Variable Description
%%subtotal%% Outputs the sub-total of the first payment. If the first payment was a free trial period, this will be 0.00. If the first payment was a paid trial period, this will be the subtotal of the trial period payment.
%%total%% Outputs the sub-total + tax of the first payment. If the first payment was a free trial period, this will be 0.00. If the first payment was a paid trial period, this will be the total of the trial payment.
%%tax_amount%% Outputs the tax amount of the first payment. If the first payment was a free trial period, this will be 0.00. If the first payment was a paid trial, it will be the tax amount of the paid trial payment.
%%tax_rate%% Outputs the user's tax rate on this purchase.
%%txn_num%% Outputs the Transaction Number of the first payment. For recurring payments, this transaction number will most likely be a temporary number generated by MemberPress as it takes some time for the payment gateway to process the first payment.
%%sub_id%% Outputs the ID of the recurring subscription. If the purchase made is not recurring, this variable will not be replaced.
%%txn_id%% Outputs the ID of the first transaction. For recurring subscriptions, this ID will in most cases be the ID of the hidden grace-period
%%sub_num%% Outputs the Subscription Number of the recurring subscription. If the purchase made is not recurring, this variable will not be replaced. With PayPal Standard, this may be a temporary number generated by MemberPress as it can take some time for the gateway to update the record with a valid subscription number.
%%membership_amount%% Outputs the regular recurring cost of a recurring subscription. If the purchase made is not recurring, this variable will not be replaced.
%%trial_days%% Outputs the number of days in the paid or free trial period for a recurring subscription. If the purchase made is not recurring, this variable will not be replaced.
%%trial_amount%% Outputs the cost of the trial period for a recurring subscription. If the purchase made is not recurring, this variable will not be replaced.
%%username%% Outputs the member's username. If you have configured the MemberPress Settings page to make the user's email address their username, then this will output their email address.
%%user_email%% Outputs the member's email address.
%%user_id%% Outputs the member's WordPress User ID.
%%membership_name%% Outputs the name (title) of the Membership purchased.
%%membership_id%% Outputs the ID of the Membership.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.