Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Created October 13, 2020 19:39
Show Gist options
  • Save ronalfy/eb873b1f34b837f75262b5f78a1331d0 to your computer and use it in GitHub Desktop.
Save ronalfy/eb873b1f34b837f75262b5f78a1331d0 to your computer and use it in GitHub Desktop.
PMPro - Change Never Label Message for Recurring Levels
<?php
/**
* Changes the output label to Recurring in member/order lists for recurring levels.
*
* 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.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/**
* Checks if a level is recurring and modifies output label.
*/
function my_pmpro_change_membership_expires_label( $date_format, $pmpro_user_data ) {
if ( function_exists( 'pmpro_has_recurring_level' ) ) {
if ( pmpro_has_recurring_level( $pmpro_user_data->ID ) ) {
return 'Recurring';
}
}
return $date_format;
}
add_filter( 'pmpro_memberslist_expires_column', 'my_pmpro_change_membership_expires_label', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment