I'm scheduling a job in wp cron:
add_action('my_cron_hook', 'my_cron_action');
wp_schedule_event( time(), 'interval1', 'my_cron_hook' );
function my_cron_action(){
//do something
}
The variable interval1 is set by the admin in another part of the code.
Also, there is a switch that lets the admin enable or disable the wp crop job.
My problem is this:
my_cron_action is executed as soon as it is scheduled
(this means, as soon as the admin enables the cron job from the backend).
What i want to do is this:
if we suppose that the time that the admin enabled the job is T,
i want the job to be run at T+interval1 for the first time, and not at T.
The next thing i want after this is done, is to create a button "Execute job now" that will run the job as soon as it's clicked.