Home › Forums › Feature Requests › ACF date field email reminder › Reply To: ACF date field email reminder
The scheduling of a post works the same as any wp cron so it would not make any difference if no one visits your site. I think the right way to go is to create your own cron job as you initially thought.
To make wp cron more reliable is actually pretty simple if you have access to cron on your server/hosting.
https://tommcfarlin.com/wordpress-cron-jobs/
I don’t know what “Advanced Custom Fields Contact Forms” is but I assume it’s a third party plugin. I will assume it creates a CPT which all the submissions are saved to as posts.
I would create a cron job that triggers a function. In the function you query the submissions for date values where the date is in two days from today. Then in the loop you find the users email and send out an email using wp_mail. It’s all fairly simple if you’re familiar with PHP 🙂
Here’s how to get a date two days from now:
$date = date('Ymd', strtotime('+2 days'));
and a query
$upcoming_query = new WP_Query(array(
'post_type' => 'submissions' //whatever it is
'meta_query' => array(
'key' => 'acffield',
'value' => $date,
'compare' => '='
),
'posts_per_page' => 100,
'no_found_rows' => true,
'update_post_term_cache' => false
));
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.