I'm trying to schedule event on hourly basis but it doesn't work. Why, I can't understand.

Here is a function that i use to schedule event.

add_action( 'scheduled_update_feeds', 'update_feeds', 10, 2 );

function scheduled_activation() {
    wp_schedule_event( time(), 'everyhour', 'scheduled_update_feeds', array( 0, 'everyhour' ) );
register_activation_hook( __FILE__, 'scheduled_activation' );

Per my understandings this should activate on plugin activation and pass schedule event based on my settings.

When I use it without array args it works, but I need to use args to pass them my scheduled function.

And this is the function

function update_feeds($ids = false, $timing = false) {
    do something

When i use it like this it works.

wp_schedule_event( time(), 'everyhour', 'scheduled_update_feeds' );

Even if I don't use args in my update_feed function it doesn't work either. The strange thing is that when I use single schedule it works.

like this

wp_schedule_single_event( time() + 10, 'scheduled_update_feeds', array($ids) );

So I don't get it why it won't work.

And I did defined 'everyhour' in my scheduled list.

add_filter( 'cron_schedules', 'my_schedule' ); 

$schedules['everyhour'] = array(
    'interval' => 60,
    'display' => __( 'Every hour', 'easy-video-grabber' )

I checked its existance with the Cron Schedules plugin and the schedule exists.

  • Why are you adding an "everyhour" schedule, when "hourly" already exists? (and an interval of "60" is one minute, not one hour). What doesn't work? Does the action not fire at all? Have you tried debugging or checking error logs? Mar 7, 2014 at 13:34
  • im adding everyhour and interval is set to one minute because of testing, i can't wait whole hour between every change. Once everything is working ill switch to hourly. What doesn't work is firing schedule when array() values are set. I tried debug but don't get any errors. Dont know where to look for error logs.
    – lonerunner
    Mar 7, 2014 at 14:00
  • Finding the error logs will save a lot of time - are you using a local server on your computer? Or remote? If the former, did you use something like WAMP/LAMP to set up? If the latter, look in cPanel/WHM. Mar 7, 2014 at 15:13
  • 1
    What does your callback function look like. I ran into similar trouble with arguments being passed along and my callback function had a parameter check if(!$var) return; that was making me think my job wasn't firing. You could install a plugin like "WP Crontrol" to see scheduled jobs and the arguments stored.
    – Cole
    Mar 28, 2014 at 23:56
  • 2
    When debugging cron jobs with WP I find it useful to log everything that's going on, have you enabled the WP error log? codex.wordpress.org/Debugging_in_WordPress#WP_DEBUG_LOG
    – Dan
    Jul 7, 2014 at 12:43

3 Answers 3


This is not a fix for your problem, but it might lead you in the right direction to solving the issue. I would suggest checking out this plugin to possibly help you find out what is going on:

WP Cron Control

It offers a quick view of cron jobs scheduled throughout your site. I recently used it to resolve a problem occurring when scheduled emails were not being sent out.


In the simplistic way. Register a filer, embed with action & use it. For quick example:

Register an event:

// Create new cron job filter
add_filter( 'cron_schedules', 'cron_add_five_minute' );
function cron_add_five_minute( $schedules ) {
  // Adds once weekly to the existing schedules.
  $schedules['five_minute'] = array(
      'interval' => 300,
      'display' => __( 'Five Minute' )
  return $schedules;

Execute functions:

add_action( 'wpfex_five_minute_event', 'wpfex_do_this_five_minute' );

 * On the scheduled action hook, run a function.
function wpfex_do_this_five_minute() {
    // Execute file every five minutes      
    // Do what ever you want to do

*Please note that wp cron jobs are different than usual linux cron jobs. Wordpress internally run thread on when user hit the website. If no hit on website in a day then there is not cron job executed, because cron job thread is not running.

For more information how cron jobs work in WP, check this quick reference guide



I've had this problem before. What is happening (from the looks of it) is that you are setting up the action hook to be scheduled, but failing to make use of it.


function update_feeds($ids = false, $timing = false) {
   do something
wp_schedule_event( time(), 'everyhour', 'scheduled_update_feeds' );

In addition to this, you would need something like:

add_action('scheduled_update_feeds', 'update_feeds', 10, 2);

wp_schedule_event sets up an action to be run, so in addition to a function to do things, you need to add an action to be carried out on the action tag specified.

  • Your wp_schedule_event tells wordpress to do_action on scheduled_update_feeds on a regular basis
  • Your running function contains your processing to be done
  • You need to use add_action on scheduled_update_feeds to carry out your function.

I'd also recommend checking to see if it exists before adding it:

$next_run = wp_next_scheduled('scheduled_update_feeds');
if ( $next_run ) {
    wp_unschedule_event( $next_run, 'scheduled_update_feeds');
$first_run = time();
$result = wp_schedule_event( $first_run, 'everyhour', 'scheduled_update_feeds');

Finally, I'd recommend using less generic names, especially for your processing function. There are probably plenty of people out there that will create an update_feeds function.

Anywise, hope that helps.

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.