Last active
July 20, 2022 07:55
-
-
Save patrickposner/f7f3cbb1f55e7869657d7ccfb4ad8177 to your computer and use it in GitHub Desktop.
Filr: Send e-mail before file expires.
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 | |
add_action( 'filr_before_check_expire_date', function( $expiration_date, $today ) { | |
$difference = $expiration_date->diff( $today ); | |
// Get difference in days. | |
if ( $difference->d <= 2 ) { | |
// prepare and send the e-mail. | |
$to = '[email protected]'; | |
$subject = 'File will expire in 2 days.'; | |
$headers = array( 'Content-Type: text/html; charset=UTF-8' ); | |
$body = ''; | |
// Now we can send the e-mail. | |
wp_mail( $to, $subject, $body, $headers ); | |
} | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment