Custom post expiration cron intervals

Sometimes during testing you want the post expiration cron to run at very short intervals, but no short interval is available in the CRED editor. To enable custom cron intervals, add the following code to functions.php:

/* --------------------------------------------- */
// CUSTOM POST EXPIRATION CRON INTERVALS
add_filter ('cred_post_expiration_cron_schedules', 'my_cred_post_exp_cron_func', 10,1);
function my_cred_post_exp_cron_func ($schedules) {
  $schedules['onemin'] = array( 'interval' => MINUTE_IN_SECONDS, 'display' => __( 'Every Minute' ) );
  $schedules['twomin'] = array( 'interval' => 2 * MINUTE_IN_SECONDS, 'display' => __( 'Every 2 Minutes' ) );
  return $schedules;
}

Add or remove custom intervals as needed.


Let us know if this snippet is not working for you:

This snippet doesn’t work
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments