# Paid Memberships Pro: Membership End Date Shortcode

> Adds a [wpide_pmpro_expires] shortcode that shows when the member's current level ends, or "never" for levels without an end date.

- Type: PHP
- Runs: Run everywhere
- Category: [Memberships](https://wpide.com/library/category/memberships/)
- Tags: pmpro, expiry, shortcode
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/pmpro-expiration-date-shortcode/

## Code

```php
if ( ! function_exists( 'pmpro_getMembershipLevelForUser' ) ) {
    return;
}

add_shortcode( 'wpide_pmpro_expires', function ( $atts ) {
    $atts = shortcode_atts( array( 'never' => 'never', 'none' => '' ), $atts, 'wpide_pmpro_expires' );

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

    $level = pmpro_getMembershipLevelForUser( get_current_user_id() );

    if ( empty( $level ) ) {
        return esc_html( $atts['none'] );
    }

    return esc_html( empty( $level->enddate ) ? $atts['never'] : wp_date( get_option( 'date_format' ), (int) $level->enddate ) );
} );
```

## Notes

Recurring levels usually have no end date and show the "never" text; change it with never="renews automatically".

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Paid Memberships Pro: Membership End Date Shortcode" 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/
