• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Plugins » WP-Members » Documentation » Shortcodes » Login Status Shortcodes

Login Status Shortcodes

The status shortcodes can be used to display content to users based on their login status.  There are two shortcodes:

  • Logged in content
  • Logged out content

Logged in content

The logged in shortcode is used for content that will display to a user that is logged in.  This can be used on any page, including special pages created with other shortcodes, such as the user profile area or a registration page.

Basic usage of the shortcode:

[wpmem_logged_in] This content can only be seen by logged in users. [/wpmem_logged_in]

Beyond the basic usage, the shortcode accepts the following attributes:

  • ID
  • role
  • meta_key/meta_value
  • product | membership

ID and Role attributes

The logged in shortcode can be used to display content only to specific user IDs or to specific roles.

The following example will display content only to a user whose ID is 123:

[wpmem_logged_in id=123]This content will only display to the user whose ID is 123[/wpmem_logged_in]

The following example will display content only to a user with the editor role:

[wpmem_logged_in role=editor]This content will only display to users with the editor role[/wpmem_logged_in]

Multiple IDs or roles can be specified when separated by commas.

This example would display only if the user has an ID of 123, 345, or 456:

[wpmem_logged_in id="123,345,456"]This appears to users with ID 123, 345, or 456[/wpmem_logged_in]

This would only display if the user has a role of “editor” OR “subscriber”:

[wpmem_logged_in role="editor,subscriber"]This content displays for editor role and subscriber role[/wpmem_logged_in]

Meta Key and Meta Value attributes

The logged in shortcode can also be used to display content to users who have a specific meta key/value. The attributes should be used as a pair as passing the key to check and the value is currently required.

For example, this would restrict content to users who have “the_value” as the value of “my_special_field”:

[wpmem_logged_in meta_key="my_special_field" meta_value="the_value"]This is restricted to users who have “the_value” as the value for “my_special_field”[/wpmem_logged_in]

If the meta key/value comparison needs to check if the value is “not equal” instead, you can use the “compare” attribute to check that the value is not equal – “!=”:

[wpmem_logged_in meta_key="my_special_field" meta_value="the_value" compare="!="]This is restricted to users who do not have “the_value” as the value for “my_special_field”[/wpmem_logged_in]

Membership attribute

For restricting content to user who have a specific membership enabled, you can specify the membership slug using either the “membership” attribute:

[wpmem_logged_in membership="my_membersip_product_slug"]This will display to users who have “my_membership_product_slug” access.[/wpmem_logged_in]

If you do not know the slug for the membership, go to Memberships > All Memberships and look in the “slug” column of the table for the membership you’re looking for.

Subscription content (PayPal extension only)

When used with the premium add-on module WP-Members PayPal Subscription extension it should first be noted that the basic logged in/out parameters are unaffected.  For example, if content is wrapped with the status shortcode for logged in status, the content will be viewable to a logged in user regardless of whether their subscription has expired or not.  The reason for this behavior is that some content may be necessary for a user to see when they are logged in, even if they are expired.

For subscription content that should be shown only if a user is logged in AND has a current (paid) subscription, the status shortcode will accept the “sub” attribute (for “subscription” or “subscribers only”).  This attribute can also accept a second optional parameter of “msg” to display a message that the content is based on subscription and the user is expired.  The “msg” attribute is a true/false boolean and defaults to false if not set.  A value of true will display the message, false will not.

[wpmem_logged_in status="sub" msg="true"]This is content for current subscribers only.  If the “msg” parameter is false or omitted, it will simply not display.  If “msg” is true, an expiration message will display in place of the protected content[/wpmem_logged_in]

Logged out content

The logged out shortcode displays content that will be shown to a user that is not logged in.  This can be used on any page, including special pages created with other shortcodes, such as the members settings area or a registration page.

[wpmem_logged_out] this content displays when a user is not logged in. [/wpmem_logged_out]

  • Getting Started
  • Recommended WordPress® Settings
  • Plugin Settings
    • Options
    • Fields
    • Dialogs
    • Emails
    • New Feature Settings
  • Managing Content
    • Restricting Posts
    • Restricting Pages
    • Show Excerpts
    • Custom Post Types
  • Managing Users
    • Import Users
    • Export Users
    • Edit Users
    • Search Users
  • Login
  • Registration
    • Choosing Fields
    • Create a Registration Page
    • Moderating Registration
    • Using CAPTCHA
    • Removing Registration Options
  • User Profile
  • Memberships
    • Membership Properties
    • Membership Levels
  • Menus
    • Individual Menu Items
    • Logged In Menus
    • Login/Logout Menu Link
  • Customizing Emails
    • Email Address
    • Email Content
    • Email Format
    • Email Shortcodes
    • Email Troubleshooting
  • Customizing Forms
    • Create a Custom Stylesheet
    • Using the WordPress Customizer
    • Login Form HTML
    • Registration Form HTML
    • Widget Login Form HTML
  • Translation and Localization
    • Maintain a custom translation file
    • Filter untranslated strings
    • Multi-language Considerations
  • Shortcodes
    • Pages and Forms
    • Login Status
    • User Fields
    • Memberships
    • Email
    • Other Shortcodes
  • WP-CLI Commands
  • API Functions
  • Filter Hooks
  • Action Hooks
  • FAQs
    • Email troubleshooting
    • Passwords are not being included in Emails
    • The plugin isn’t blocking my content
    • Are files protected?
    • How can I prevent registration spam?
    • How to add a shortcode
    • How to apply login redirects
    • Why can’t users log in?
    • Why does reCAPTCHA v3 fail?
    • Troubleshooting Really Simple Captcha
    • Why do I get a 403 error?
    • How do I use code snippets?
    • My changes aren’t showing up
    • How to hide the “Admin Bar”
    • How to add a forgot password link
    • Password reset doesn’t show any fields
    • Domain not included in the password reset link
    • There was an error processing the form
    • Hidden vs. Restricted
  • Demo Videos
  • How to Request Support
  • Copy Settings for Support
  • Hosting Recommendations

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy