I'm currently developing a plugin which uses WP cron. During the installation of the plugin, I'm creating 2 needed cron jobs with a timestamp of midnight -2 and a and midnight -1 hour, since job 2 should only run 1 hour after job 1.
Even when using a timestamp during creation which is 3-4 hours in the future, it seems like that both functions are getting initially executed directly after the plugin install / update, which results in a lot of issues.
wp_schedule_event( strtotime( 'midnight' ) + ( - 2 * HOUR_IN_SECONDS ), 'daily', 'test1' ); wp_schedule_event( strtotime( 'midnight' ) + ( - 1 * HOUR_IN_SECONDS ), 'daily', 'test2' );
Any idea how to prevent an initial execution of each event during creation?