Forked from ronalfy/pmpro-change-level-recurring.php
Created
November 15, 2022 20:04
-
-
Save MaryOJob/f9961e4702f972a239b8b15863bcc4ac to your computer and use it in GitHub Desktop.
PMPro - Change Never Label Message for Recurring Levels
This file contains 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 | |
/** | |
* 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