• Resolved santosh.sahoo

    (@santoshsahoo)


    Hi,

    I thought this would be the bast place to get some doubts cleared.
    Here’s my question.

    if ( !wp_next_scheduled('my_task_hook') ) {
        wp_schedule_event( time(), 'hourly', 'my_task_hook' );
    }
    
    function my_task_function() {
         wp_mail('[email protected]', 'Automatic mail', 'Hello, this is an automatically scheduled email from WordPress.');
    }
    add_action('my_task_hook', 'my_task_function');

    The above code is to schedule a cron task hourly.
    Then i use

    /usr/bin/wget -O - -q -t 1 https://www.yourdomain.com/wp-cron.php

    and set it in plesk to run it every hour.
    I have also wrote define(‘DISABLE_WP_CRON’, true) in my wp-config.php
    My actual question here is :
    Do i have to set the wget command to run every hour , if i’m setting the schedule as hourly in my wordpress code .??
    Similarly , if i have to run the wget command every day( daily) , do i need to set the worpress cron fuction as wp_schedule_event( time(), ‘daily’, ‘my_task_hook’ )??

    Regards

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Real CRON set up .’ is closed to new replies.