WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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' );
share|improve this question
When/how is your object instantiated? – Rarst Nov 18 '13 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 '13 at 21:23
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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