Skip to content

Instantly share code, notes, and snippets.

@dwanjuki
Created February 1, 2023 15:44
Show Gist options
  • Save dwanjuki/28a98311443edd3b2a96e94065cd1333 to your computer and use it in GitHub Desktop.
Save dwanjuki/28a98311443edd3b2a96e94065cd1333 to your computer and use it in GitHub Desktop.
This recipe makes the !!renewaldate!! variable available for use in all Paid Memberships Pro emails.
<?php
/**
* This recipe makes the !!renewaldate!! variable available for use in all Paid Memberships Pro emails.
* When the variable is empty it will display nothing instead of the !!renewaldate!! email variable
*
* Notice the array key does not include the !!s
*
* 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/
*/
function my_pmpro_email_renewaldate_data( $data ) {
$data['renewaldate'] = date( get_option( "date_format" ), pmpro_next_payment() );
return $data;
}
add_filter( 'pmpro_email_data', 'my_pmpro_email_renewaldate_data', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment