codeNinja codeNinja - 3 years ago 188
PHP Question

Wordpress cron jon every 6 hours

I currently have a Cron Job setup to run every hour. I actaully want to change it to run every 6 hours. I could not find a "sixhourly" setting. Am i missing something?

if (!wp_next_scheduled('retrySysProHook')) {
wp_schedule_event(time(), 'hourly', 'retrySysProHook');

Answer Source

Allows you to set custom schedules.

Has this example:

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' );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download