0

I was watching this: Wp_Schedule_Event every day at specific time and im wondering if I do the following will it replace all my schedules?

function myprefix_custom_cron_schedule( $schedules ) {
    $schedules['every_six_hours'] = array(
        'interval' => 21600, // Every 6 hours
        'display'  => __( 'Every 6 hours' ),
    );
    return $schedules;
}
add_filter( 'cron_schedules', 'myprefix_custom_cron_schedule' );

I have more cron jobs running but if I do this will it replace the timer? For example, I have 1 running 1 time every hour, will it be replaced? Just wondering if it will mess up the cron_shedules.

0

This won't affect your existing scheduled Cron events, as they already have a schedule interval set. It will only add a new custom schedule interval that will be available for new ones. So long as you are adding to the $schedules array and returning it (which you are) then it will all be fine.

  • thanks alot! i took the risk and tried it anyway :P. thanks for your answer! – Alexis Garcia Oct 9 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.