Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ideadude/c09ca54c943dea7e91a30a4ef6ff7179 to your computer and use it in GitHub Desktop.
Save ideadude/c09ca54c943dea7e91a30a4ef6ff7179 to your computer and use it in GitHub Desktop.
Update prices on the pricing page for current members with Paid Memberships Pro.
/*
Update Prices on the Pricing page for current members.
Add this code to a custom plugin.
*/
function pmpro_level_cost_text_filter_pricing_page($cost, $level, $tags, $short) {
//if we're not on the pricing page, just return
global $pmpro_pages;
if(!is_page($pmpro_pages['levels']))
return $cost;
//disable this filter so we don't get caught in a loop
remove_filter('pmpro_level_cost_text', 'pmpro_level_cost_text_filter_pricing_page', 10, 4);
//grab the level and run it through the checkout filter
$level = apply_filters('pmpro_checkout_level', $level);
$cost = pmpro_getLevelCost($level, $tags, $short);
//reenable this filter
add_filter('pmpro_level_cost_text', 'pmpro_level_cost_text_filter_pricing_page', 10, 4);
return $cost;
}
add_filter('pmpro_level_cost_text', 'pmpro_level_cost_text_filter_pricing_page', 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment