Banner for Advanced Code Recipe Tutorial for Paid Memberships Pro

The membership_expired email template is sent when a user’s membership has expired (as long as their membership level had a set expiration period such as 1 year, or a set expiration date like 2023-01-01).

However, this only informs a user that their membership has expired and does not include any data related to the expired level.

This code recipe fetches the last expired membership level via SQL query and adds the level name as an email variable—which can be used to personalize the message.

This content requires a premium membership plan.