I am trying to add a custom cron_schedule interval inside a plugin and then use that custom interval to schedule a cron event when the plugin is activated. It seems that the custom interval is not available though when the activate code is executed. Using any of the default intervals adds the scheduled event, but if I try to use the custom one, it doesn't get added. The custom interval is indeed added (I can see it by echoing wp_get_schedules) but isn't available when I try to add the scheduled event on activation.

My problem seems to be fairly identical to this one: Using wp_cron with custom time interval and the register activation hook

But, I've already tried removing underscores from my hooks and the event is still not scheduled using the custom interval. All the default intervals work, though.

Any thoughts on how I can get this to work?

private function __construct() {
  // Add custom cron schedule
  add_filter( 'cron_schedules', array($this, 'add_custom_cron_schedule' ));

public function add_custom_cron_schedule( $schedules ) {
  $schedules['minute'] = array(
    'interval' => 60,
    'display' => __( 'Every Minute', $this->plugin_slug )

  return $schedules;

// Called from register_activation_hook, this doesn't get added
// when using 'minute', but will work if using a WP default like 'daily'
public static function single_activate() { 
  wp_schedule_event( time(), 'minute', 'cronFunction' );
  • 1
    When/how is your object instantiated?
    – Rarst
    Nov 18, 2013 at 21:14
  • In the plugin file, I call: add_action( 'plugins_loaded', array( 'PLUGIN_NAME', 'get_instance' ) ); and 'get_instance' instantiates the object. Is this a case of where using a class based approach to a plugin gets in the way of what I want to do?
    – edeneye
    Nov 18, 2013 at 21:23
  • Is not the problem that when you're activating you plugin your custom schedule is not yet registered. Jul 22, 2019 at 12:01

1 Answer 1


Wondering if there was an issue with using a class based plugin and the order in which things are instantiated and called, I rewrote the plugin using "procedural" functions (I'm not exactly sure of the terminology for this ... A non-class based plugin) and it is working as intended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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