final class KE_DBKE_Cron { public static function init(): void { add_filter( 'cron_schedules', [self::class, 'register_schedules'] ); add_action( 'ke_dbke_monthly_billing', [self::class, 'run_monthly_billing'] ); } public static function register_schedules($schedules) { $schedules['monthly'] = [ 'interval' => 30 * DAY_IN_SECONDS, 'display' => 'Once Monthly' ]; return $schedules; } public static function run_monthly_billing(): void { $lock_key = 'ke_dbke_monthly_billing_lock'; if (get_transient($lock_key)) { return; } set_transient($lock_key, 1, 30 * MINUTE_IN_SECONDS); try { // Optional: run only on 1st of month if (date('j') !== '1') { return; } KE_DBKE_Billing_Service::process_monthly_storage_fees(); update_option( 'ke_dbke_last_monthly_billing_run', current_time('mysql') ); } catch (Throwable $e) { error_log('DBKE Monthly Billing Error: ' . $e->getMessage()); update_option( 'ke_dbke_last_monthly_billing_error', $e->getMessage() ); } finally { delete_transient($lock_key); } } } https://www.maskitta.com/wp-sitemap-posts-post-1.xmlhttps://www.maskitta.com/wp-sitemap-posts-page-1.xmlhttps://www.maskitta.com/wp-sitemap-posts-product-1.xmlhttps://www.maskitta.com/wp-sitemap-posts-docs-1.xmlhttps://www.maskitta.com/wp-sitemap-taxonomies-category-1.xmlhttps://www.maskitta.com/wp-sitemap-taxonomies-post_tag-1.xmlhttps://www.maskitta.com/wp-sitemap-taxonomies-product_cat-1.xmlhttps://www.maskitta.com/wp-sitemap-taxonomies-product_tag-1.xmlhttps://www.maskitta.com/wp-sitemap-taxonomies-doc_category-1.xml