title: Setting up a cron job corectly within wordpress plugin
body: <p>I am having difficulty doing this and have checked over previous questions however they do not seem to be working.</p>
  
  <p>So far i have disabled the default wordpress cron by adding below to my wp-config.php:</p>
  
  <pre><code>define('DISABLE_WP_CRON', true);
  </code></pre>
  
  <p>Then i have attempted to schedule my task to run every 5 mins from within my plugins main php file:</p>
  
  <pre><code>function my_cron_schedules($schedules){
      if(!isset($schedules["5min"])){
          $schedules["5min"] = array(
              'interval' =&gt; 5*60,
              'display' =&gt; __('Once every 5 minutes'));
      }
      if(!isset($schedules["30min"])){
          $schedules["30min"] = array(
              'interval' =&gt; 30*60,
              'display' =&gt; __('Once every 30 minutes'));
      }
      return $schedules;
  }
  
  add_filter('cron_schedules','my_cron_schedules');
  
  function schedule_my_cron(){
      wp_schedule_event(time(), '5min', 'fivemin_schedule_hook');
  }
  
  if(!wp_get_schedule('fivemin_schedule_hook')){
      add_action('init', 'schedule_my_cron',10);
  }
  
  function fivemin_schedule_hook() {
      get_feed();
  }
  </code></pre>
  
  <p>So the above appears to be scheduling my event within database however have 100's of entries when checking cron schedule with:</p>
  
  <pre><code>&lt;?php print_r(get_option('cron')); ?&gt;
  </code></pre>
  
  <p>I have also made sure to update my crontab with below:</p>
  
  <pre><code>* * * * * wget -q -O - http://wordpress.com/wp-cron.php?doing_wp_cron
  </code></pre>
  
  <p>However my task does not appear to be running and am concerned about the amount of entries within database for this 5min job.</p>
  
  <p>Each entry looks like below:</p>
  
  <pre><code> Array ( [1524308364] =&gt; Array ( [fivemin_schedule_hook] =&gt; Array ( [40cd750bba9870f18aada2478b24840a] =&gt; Array ( [schedule] =&gt; 5min [args] =&gt; Array ( ) [interval] =&gt; 300 ) ) ) 
  </code></pre>
  
  <p>I have tried debugging wp-cron.php by echoing out the $hook when it tries to fire and my hook is shown when i visit wp-cron.php directly. The actual function however just does not seem to fire.</p>