2

I am testing the wp_schedule_single_event function and it is currently not working on my upgraded version of wordpress.

It looks like the event is being scheduled but the code in my hook is never executed. Any help with this matter would be greatly appreciated

Here is example code I put in my themes function.php:

var_dump(get_option('test_action_option'));
if(isset($_GET['begintest'])){
    update_option('test_action_option', 'Scheduled: ' . $_GET['begintest']);
    wp_clear_scheduled_hook( 'event_test_action'); // clear anything else in the system
    wp_schedule_single_event( time() + 10, 'event_test_action');
}

add_action('event_test_action', 'event_test_action');
function event_test_action(){
    update_option('test_action_option', 'Ran');
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.