Hi,
I’m wondering if it’s possible to send reminder emails out from WP using a date set via ACF? I’m setting up a website for my local basketball team and trying to work out how I would send reminders to my subscribers for upcoming games based on a date I would set in the post as an ACF.
I know this is a bit of a broad request, but if anyone could help me along the right path, then I’d be very appreciative and would gladly publish a tutorial on how to do this so it can help others…
Thanks
Osu
Hi @onesizeup
Yes, this is very possible.
You can write a custom function which generates and sends an email. The content of this email can contain any data you wish, so yes, you can pull in an ACF value using get_field
.
Perhaps you would add an action to the save_post
, and use the ACF value to schedule a cron function to send out the email?
http://codex.wordpress.org/Category:WP-Cron_Functions
I’m not exactly sure how you want the functionality to work, but yes, you can load in an ACF value.
Thanks
E
Hi Elliot,
Thanks for getting back to me. I’ll use that information to get going and see where I get. The main issue I foresee though is that the WP_Cron functions is that they require someone to visit your site for the function to run at the scheduled time…
I guess another method might be to write a script that is run every day by a server-based cron job to check posts and send out emails if the ACF date is within a certain range.
If I’m successful with this (!), I’ll follow up on my promise of writing a tutorial for you (should you be interested).
Thanks,
Osu
Hello Elliot and Osu, I need to do exactly the same thing, but I’m not a good coder! Can you give me some more precisely advice or a draft code? Thanks in advance, any help will be greatly appreciated!
Also need this. Any example code?