I have done define('DISABLE_WP_CRON', 'true');
in wp-config.php
.
I set up the cron path but I actually do not know how to write code so that calling that URL will execute my code. I want to write real cron job over WordPress cron job.
I tried with this in function.php
but it did not work:
if (! wp_next_scheduled ( 'my_hourly_event' )) {
wp_schedule_event(time(), 'hourly', 'my_hourly_event');
}
add_action('my_hourly_event', 'do_this_hourly');
function do_this_hourly() {
// do something every hour
}