How to setup a Custom cron job for checking a Post Expiry – CRED

In Toolset >> Settings >> Forms >> Check for expired content >> we have options like “Once hourly, Daily, etc…”

You can enforce that checking using the below code snippet. It will enforce this check and you will see the newly added option in Toolset >> Settings >> Form, like check expiry after “Every 2 minutes” (you can change the value in this code as needed):


add_filter ('cred_post_expiration_cron_schedules', 'my_cred_post_exp_cron_func', 10,1);

function my_cred_post_exp_cron_func ($schedules) {
$schedules['twomin'] = array( 'interval' => 2 * MINUTE_IN_SECONDS, 'display' => __( 'Every 2 minutes' ) );
return $schedules;
}