This code recipe allows you to specify how far into a term you are and set your level to expire based on the time remaining. This was originally created for a site related to pregnancies, but it can be adapted for various uses.

For example, a member with a 9-month total term can specify that they are 2 months in. Then, the expiration date would be set for 7 months from now.

Note that if you are using Paid Memberships Pro V2.9+, you can create the terms custom field using the User Fields settings page.

Set a Level to Expire Based on Remaining Time in Term

The Code Recipe (PHP)

Adding the Recipe to Your Website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics
Was this article helpful?