Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_Install::create_cron_jobs()
Create cron jobs (clear them first).
Description Description
Source Source
File: includes/class-wc-install.php
private static function create_cron_jobs() { wp_clear_scheduled_hook( 'woocommerce_scheduled_sales' ); wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' ); wp_clear_scheduled_hook( 'woocommerce_cleanup_sessions' ); wp_clear_scheduled_hook( 'woocommerce_cleanup_personal_data' ); wp_clear_scheduled_hook( 'woocommerce_cleanup_logs' ); wp_clear_scheduled_hook( 'woocommerce_geoip_updater' ); wp_clear_scheduled_hook( 'woocommerce_tracker_send_event' ); $ve = get_option( 'gmt_offset' ) > 0 ? '-' : '+'; wp_schedule_event( strtotime( '00:00 tomorrow ' . $ve . absint( get_option( 'gmt_offset' ) ) . ' HOURS' ), 'daily', 'woocommerce_scheduled_sales' ); $held_duration = get_option( 'woocommerce_hold_stock_minutes', '60' ); if ( '' !== $held_duration ) { wp_schedule_single_event( time() + ( absint( $held_duration ) * 60 ), 'woocommerce_cancel_unpaid_orders' ); } // Delay the first run of `woocommerce_cleanup_personal_data` by 10 seconds // so it doesn't occur in the same request. WooCommerce Admin also schedules // a daily cron that gets lost due to a race condition. WC_Privacy's background // processing instance updates the cron schedule from within a cron job. wp_schedule_event( time() + 10, 'daily', 'woocommerce_cleanup_personal_data' ); wp_schedule_event( time() + ( 3 * HOUR_IN_SECONDS ), 'daily', 'woocommerce_cleanup_logs' ); wp_schedule_event( time() + ( 6 * HOUR_IN_SECONDS ), 'twicedaily', 'woocommerce_cleanup_sessions' ); wp_schedule_event( time() + MINUTE_IN_SECONDS, 'fifteendays', 'woocommerce_geoip_updater' ); wp_schedule_event( time() + 10, apply_filters( 'woocommerce_tracker_event_recurrence', 'daily' ), 'woocommerce_tracker_send_event' ); }