WP Cron job Not Executing

I’m trying to execute a WP cron job but it doesn’t seem to be executed (even XDebuger doesn’t seem to fire).

add_action('init', initing_cron);
add_action('my_test_cron', my_cron);

function initing_cron()
    if (!wp_next_scheduled('my_test_cron'))
        wp_schedule_event(time(), '2min', 'my_test_cron');

function my_cron()
    $var = '';
    file_put_contents(__DIR__ . DIRECTORY_SEPARATOR .'crontest.txt', 'hello world');

I’d really appreciate if anyone could let me know what I’m doing wrong. There are no cache plugins installed. It seems wp_next_scheduled is actually returning the correct value. It just doesn’t seem to fire my_cron() at all.

Read more here: WP Cron job Not Executing

Leave a Reply

Your email address will not be published. Required fields are marked *