I'd like to send an email (only one) to a specific user every 12 months after a given date. Would you please provide me with the PHP code that would allow me to specify the starting date and send the email?

closed as too broad by cjbj, bueltge, cybmeta, kaiser Dec 2 '16 at 16:32

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Set update_user_meta() for a WP_User if get_user_meta() ends up empty.

Update a key with a future date for the next year:

$futureDate=date('Y-m-d', strtotime('+1 year', strtotime($startDate)) );

Schedule an event in one year with wp_schedule_event() or use 'daily' to check all users for a relative year date.

// WP_User_Query arguments
$args = array (
    'meta_query'     => array(
            'key'       => 'future_email_date',
            'value'     => date('Y-m-d'),
            'compare'   => '<=',
            'type'      => 'DATETIME',

// The User Query
$user_query = new WP_User_Query( $args );

When you find a match, use wp_mail() to send your email.

Not the answer you're looking for? Browse other questions tagged or ask your own question.