0

I have my linux cron set to run every two minutes

*/2 * * * * wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Then I have my cron function written like this:

// add cron event
function my_wpcron_activation() {

    if ( ! wp_next_scheduled( 'my_awesome_event' ) ) {

        wp_schedule_event( time(), 'oneminute', 'my_awesome_event' );

    }

}

register_activation_hook( __FILE__, 'my_wpcron_activation' );

It's currently working, but I don't understand the flow. Every 2 minutes there's a wget on wp-cron.php. Then does that trigger my event my_awesome_event 1 minute later?

Or is it the case that because I'm using linux cron, my_awesome_event will run every 2 minutes regardless of how it's scheduled within WP?

Thanks

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.