Created
February 6, 2020 10:23
-
-
Save andrewlimaza/96b017957ca3f465447083775b82eb80 to your computer and use it in GitHub Desktop.
Remove trial limit for existing members. [Paid Memberships Pro]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/