# MemberPress: List the Member's Active Memberships

> Adds a [wpide_mepr_memberships] shortcode that lists the logged-in member's active memberships by name, for welcome boxes and account pages.

- Type: PHP
- Runs: Run everywhere
- Category: [Memberships](https://wpide.com/library/category/memberships/)
- Requires: MemberPress
- Tags: memberpress, shortcode, account
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/memberpress-my-memberships-shortcode/

## Code

```php
if ( ! class_exists( 'MeprUser' ) ) {
    return;
}

add_shortcode( 'wpide_mepr_memberships', function ( $atts ) {
    $atts = shortcode_atts( array( 'none' => 'You do not have an active membership.' ), $atts, 'wpide_mepr_memberships' );

    if ( ! is_user_logged_in() ) {
        return '';
    }

    $member = new MeprUser( get_current_user_id() );
    $ids    = array_unique( array_map( 'intval', (array) $member->active_product_subscriptions( 'ids' ) ) );

    if ( ! $ids ) {
        return '<p class="wpide-mepr-none">' . esc_html( $atts['none'] ) . '</p>';
    }

    $html = '<ul class="wpide-mepr-memberships">';
    foreach ( $ids as $id ) {
        $html .= '<li>' . esc_html( get_the_title( $id ) ) . '</li>';
    }

    return $html . '</ul>';
} );
```

## Notes

Shows the optional none="..." text when the member has no active membership.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "MemberPress: List the Member's Active Memberships" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
