Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewlimaza/96b017957ca3f465447083775b82eb80 to your computer and use it in GitHub Desktop.
Save andrewlimaza/96b017957ca3f465447083775b82eb80 to your computer and use it in GitHub Desktop.
Remove trial limit for existing members. [Paid Memberships Pro]
<?php
/**
* Remove custom trial for existing members (when existing member changes levels/renews)
* Adjust the level ID on line 16 to match your needs.
* Add this code to your WordPress site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_level_adjustment( $level ) {
// Bail if the user currently doesn't have a membership level.
if ( ! pmpro_hasMembershipLevel() ) {
return $level;
}
// If it's not the level with the trial amount, just bail.
if ( $level->id != '9' ) {
return $level;
}
$level->trial_limit = '0';
$level->trial_amount = '0';
return $level;
}
add_filter( 'pmpro_checkout_level', 'my_pmpro_level_adjustment', 10, 1 );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Remove Trial Periods for Existing Members" at Paid Memberships Pro here: https://www.paidmembershipspro.com/remove-trial-period-for-existing-members/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment