Notify the user by e-mail after the creation of a post

There’s wp_schedule_single_event:

$in_ten_minutes = time() + 10 * 60;
$post_id = get_the_ID();
wp_schedule_single_event( $in_ten_minutes, 'notify_post_event', array( $post_id ) );

or similar – I’ve no idea if it’s just the post ID you need, or whether get_the_ID() is the right way to find it when you’re handling this action. Depending on where the button is and how you want to handle the button press (AJAX? POST back to the page?) this may need to go in an AJAX handler somewhere, and have the post ID and any other values passed in.

And you’ll need a handler function too, e.g.

function notify_post_event_handler( $post_id ) {
    $the_post = get_post( $post_id );
    $author_email = get_the_author_meta( 'user_email', $the_post-post_author );

    wp_mail( $author_email,
        'Here is your ten minute reminder',
        'Post: ' . get_post_permalink( $post_id ) );
}
add_action( 'notify_post_event', 'notify_post_event_handler', 10, 1 );

and this will be triggered after ten minutes by the wp_cron processing, so you’ll need to make sure you have something set up to regularly trigger wp_cron jobs if you don’t have enough constant volume of visitors to trigger it automatically after ten minutes.

tech