MainWP Community

Reduce Action Scheduler Retention Period to One Week in WooCommerce

Set the Action Scheduler retention period to one week if using WooCommerce on your child site.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'action_scheduler_retention_period', 'wc_action_scheduler_purge' );
/**
 * Change Action Scheduler default purge to 1 week
 */
function wc_action_scheduler_purge() {
 return WEEK_IN_SECONDS;
}

Default Action Scheduler retention purge is set to run every 30 days by default.