Skip to content

Instantly share code, notes, and snippets.

@dankerizer
Last active March 25, 2022 10:20
Show Gist options
  • Save dankerizer/a3613e0732d682e5043803807b07b36e to your computer and use it in GitHub Desktop.
Save dankerizer/a3613e0732d682e5043803807b07b36e to your computer and use it in GitHub Desktop.
WordPress Custom Cronjob Monthly
<?php
function wp_custom_cron_job_monthly( $schedules ) {
if(!isset($schedules['monthly'])){
$schedules['monthly'] = array(
'display' => __( 'Once monthly', 'textdomain' ),
'interval' => 2635200,
);
}
return $schedules;
}
add_filter( 'cron_schedules', 'custom_cron_job_monthly' );
@dankerizer
Copy link
Author

function my_check_activation()
{
    if (!wp_next_scheduled('run_check_activation')) {
        wp_schedule_event(time(), 'monthly', 'run_check_activation');
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment